2011-06-29 20:27:07 +00:00
|
|
|
|
using FluentNHibernate.Conventions;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
using FluentNHibernate.Conventions.Inspections;
|
|
|
|
|
using FluentNHibernate.Conventions.Instances;
|
|
|
|
|
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
2011-02-18 16:54:48 +00:00
|
|
|
|
using System.Diagnostics;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.Conventions
|
|
|
|
|
{
|
|
|
|
|
public class PrimaryKeyConvention : IIdConvention, IIdConventionAcceptance
|
|
|
|
|
{
|
|
|
|
|
public void Apply(IIdentityInstance instance)
|
|
|
|
|
{
|
2011-02-18 16:54:48 +00:00
|
|
|
|
Trace.TraceInformation("PK on {0}.{1}", instance.EntityType.Name, instance.EntityType.Name + "ID");
|
2011-01-30 07:14:05 +00:00
|
|
|
|
instance.Column(instance.EntityType.Name + "ID");
|
|
|
|
|
//instance.GeneratedBy.Assigned();
|
|
|
|
|
//instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Accept(IAcceptanceCriteria<IIdentityInspector> criteria)
|
|
|
|
|
{
|
2011-02-18 16:54:48 +00:00
|
|
|
|
criteria.Expect(x => x.Name == x.EntityType.Name + "ID");
|
2011-01-30 07:14:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|