narsil/Tanshu.Accounts.SqlDAO/Fluent/PrimaryKeyConvention.cs

28 lines
838 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Inspections;
using FluentNHibernate.Conventions.Instances;
using FluentNHibernate.Conventions.AcceptanceCriteria;
namespace Tanshu.Accounts.Conventions
{
public class PrimaryKeyConvention : IIdConvention, IIdConventionAcceptance
{
public void Apply(IIdentityInstance instance)
{
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.EndsWith("ID"));
}
}
}