2011-02-18 16:54:48 +00:00
|
|
|
|
using System;
|
|
|
|
|
using FluentNHibernate.Conventions;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using FluentNHibernate;
|
|
|
|
|
using FluentNHibernate.Conventions.Instances;
|
|
|
|
|
using FluentNHibernate.Conventions.Inspections;
|
|
|
|
|
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
using Tanshu.Accounts.SqlDAO;
|
|
|
|
|
using System.Diagnostics;
|
2011-01-31 20:33:22 +00:00
|
|
|
|
|
2011-02-18 16:54:48 +00:00
|
|
|
|
namespace Tanshu.Accounts.Conventions
|
|
|
|
|
{
|
|
|
|
|
public class NotNullConvention : IPropertyConvention, IPropertyConventionAcceptance
|
|
|
|
|
{
|
|
|
|
|
public void Apply(IPropertyInstance instance)
|
|
|
|
|
{
|
|
|
|
|
var property = instance.Property;
|
|
|
|
|
Trace.TraceInformation("Not Null on {0}.{1}", property.DeclaringType.Name, property.Name);
|
|
|
|
|
instance.Not.Nullable();
|
|
|
|
|
}
|
|
|
|
|
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
|
|
|
|
|
{
|
|
|
|
|
criteria.Expect(x => AttributeChecker.NotNull(x.Property.MemberInfo));
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-04 19:30:55 +00:00
|
|
|
|
|
2011-02-18 16:54:48 +00:00
|
|
|
|
}
|