narsil/Tanshu.Accounts.Repository/Fluent/PrimaryKeyConvention.cs
unknown 59909a5ee7 Updated NH, Code Refactoring, made all DB transactions atomic.
Must use the Repositories with Using or else bad things will happen.
2011-06-30 01:57:07 +05:30

25 lines
902 B
C#

using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Inspections;
using FluentNHibernate.Conventions.Instances;
using FluentNHibernate.Conventions.AcceptanceCriteria;
using System.Diagnostics;
namespace Tanshu.Accounts.Conventions
{
public class PrimaryKeyConvention : IIdConvention, IIdConventionAcceptance
{
public void Apply(IIdentityInstance instance)
{
Trace.TraceInformation("PK on {0}.{1}", instance.EntityType.Name, instance.EntityType.Name + "ID");
instance.Column(instance.EntityType.Name + "ID");
//instance.GeneratedBy.Assigned();
//instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.None);
}
public void Accept(IAcceptanceCriteria<IIdentityInspector> criteria)
{
criteria.Expect(x => x.Name == x.EntityType.Name + "ID");
}
}
}