narsil/Tanshu.Accounts.Repository/Fluent/InverseConvention.cs

20 lines
568 B
C#
Raw Normal View History

using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;
using System.Diagnostics;
namespace Tanshu.Accounts.SqlDAO
{
public class InverseConvention : IHasManyConvention //, IReferenceConvention
{
public void Apply(IOneToManyCollectionInstance instance)
{
var property = instance.Member;
if (!AttributeChecker.Inverse(property)) return;
Trace.TraceInformation("Inverse on {0}.{1}", property.DeclaringType.Name, property.Name);
instance.Inverse();
}
}
}