59909a5ee7
Must use the Repositories with Using or else bad things will happen.
25 lines
902 B
C#
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");
|
|
}
|
|
}
|
|
}
|