59909a5ee7
Must use the Repositories with Using or else bad things will happen.
26 lines
911 B
C#
26 lines
911 B
C#
using FluentNHibernate.Conventions;
|
|
using FluentNHibernate.Conventions.Instances;
|
|
using FluentNHibernate.Conventions.Inspections;
|
|
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
|
using Tanshu.Accounts.SqlDAO;
|
|
using System.Diagnostics;
|
|
|
|
namespace Tanshu.Accounts.Conventions
|
|
{
|
|
public class FormulaConvention : IPropertyConvention, IPropertyConventionAcceptance
|
|
{
|
|
public void Apply(IPropertyInstance instance)
|
|
{
|
|
var property = instance.Property;
|
|
Trace.TraceInformation("Formula on {0}.{1}", property.DeclaringType.Name, property.Name);
|
|
instance.Formula(AttributeChecker.GetFormula(property.MemberInfo));
|
|
instance.Generated.Always();
|
|
}
|
|
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
|
|
{
|
|
criteria.Expect(x => AttributeChecker.Formula(x.Property.MemberInfo));
|
|
}
|
|
}
|
|
|
|
}
|