本文整理汇总了C#中IIdentityInstance类的典型用法代码示例。如果您正苦于以下问题:C# IIdentityInstance类的具体用法?C# IIdentityInstance怎么用?C# IIdentityInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IIdentityInstance类属于命名空间,在下文中一共展示了IIdentityInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public void Apply(IIdentityInstance instance)
{
//规定所有表的主键都是ID
instance.Column("ID");
//主键自增
instance.GeneratedBy.Guid();
}
示例2: Apply
public void Apply(IIdentityInstance instance)
{
instance.CustomType<Guid>();
instance.Column("Id");
instance.GeneratedBy.Custom<global::NHibernate.Id.SequenceHiLoGenerator>();
instance.UnsavedValue(Guid.Empty.ToString());
}
示例3: Apply
public void Apply(IIdentityInstance instance)
{
instance.Column("Id");
instance.UnsavedValue("0");
// instance.GeneratedBy.HiLo("1000");
}
示例4: Apply
public void Apply(IIdentityInstance instance)
{
var sequenceName = NameConventions.GetSequenceName(instance.EntityType);
var columnName = NameConventions.GetPrimaryKeyColumnName(instance.EntityType);
instance.Column(columnName);
instance.GeneratedBy.Native(paramBuilder => paramBuilder.AddParam("sequence", sequenceName));
}
示例5: Apply
/// <summary>
/// Applies this primary key convention to the specified <see cref = "IIdentityInstance" />.
/// </summary>
/// <param name="instance">An <see cref = "IIdentityInstance" />.</param>
public void Apply(IIdentityInstance instance)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
instance.Column(instance.EntityType.Name + "Id");
}
示例6: Apply
public void Apply(IIdentityInstance instance)
{
instance.Column("Id");
if (instance.Type == typeof(int) || instance.Type == typeof(long)) {
instance.GeneratedBy.Identity();
} else {
instance.GeneratedBy.Assigned();
}
}
示例7: Apply
public void Apply(IIdentityInstance instance)
{
// Standard identity column name is "Id"
var abbreviation = AttributeHelper.GetTypeAttribute<AbbreviationAttribute>(instance.EntityType);
var prefix = abbreviation == null
? ""
: abbreviation.Abbreviation;
instance.Column((prefix + instance.Name).EscapeColumnName());
}
示例8: Apply
public void Apply(IIdentityInstance instance)
{
if (typeof(ISagaEntity).IsAssignableFrom(instance.EntityType))
{
instance.GeneratedBy.Assigned();
}
else
instance.GeneratedBy.GuidComb();
}
示例9: Apply
public void Apply(IIdentityInstance instance)
{
var columnName = "Id";
var idAttribute = instance.Property.MemberInfo.GetCustomAttribute<IdAttribute>();
if (idAttribute != null)
columnName = idAttribute.ColumnName;
instance.Column(columnName);
}
示例10: Apply
public void Apply(IIdentityInstance instance)
{
var tableName = instance.EntityType.Name.ToDatabaseName();
instance.Column("ID");
if (instance.Type == typeof(long))//接下来设置主键的生成方式为HiLo值方式
{
instance.GeneratedBy.HiLo(
NHibernateHiLoIdentityTableName,
NextHiValueColumnName,
"1000000000",
builder => builder.AddParam("where", string.Format("{0} = '{1}'", TableColumnName, tableName)));
}
}
示例11: Apply
/// <summary>
/// Applies primary key name.
/// </summary>
/// <param name="instance">The instance.</param>
public void Apply( IIdentityInstance instance )
{
var key = instance.EntityType.Name;
if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType ) )
{
key = key + "Lkp";
}
instance.Column ( key + "Key" );
instance.Access.CamelCaseField ( CamelCasePrefix.Underscore );
instance.GeneratedBy.Custom ( typeof( CustomTableHiLoGenerator ) );
}
示例12: Apply
public void Apply(IIdentityInstance instance)
{
instance.Column("Id");
if(instance.EntityType.BaseType==typeof(DomainEntity))
{
//instance.UnsavedValue(Guid.Empty.ToString());
instance.GeneratedBy.GuidComb();
}
else if (instance.EntityType.BaseType==typeof(Entity))
{
instance.UnsavedValue("0");
//instance.GeneratedBy.HiLo("1000");
}
}
示例13: Apply
public void Apply(IIdentityInstance id)
{
var isAssigned = id.EntityType.GetCustomAttribute<IdAssignedAttribute>();
if (isAssigned != null)
{
id.GeneratedBy.Assigned();
return;
}
if (id.Type == typeof (Guid)) id.GeneratedBy.GuidComb();
else if (id.Type == typeof (int)) id.GeneratedBy.Identity();
else if (id.Type == typeof (long)) id.GeneratedBy.Identity();
else if (id.Type == typeof(string)) id.GeneratedBy.Assigned();
else id.GeneratedBy.Assigned();
}
示例14: Apply
public void Apply(IIdentityInstance instance)
{
instance.GeneratedBy.HiLo("1000");
}
示例15: Apply
public void Apply(IIdentityInstance instance)
{
instance.Column($"{instance.EntityType.Name}ID");
instance.GeneratedBy.HiLo("[dbo].[Ids]", "NextHigh", "9", $"EntityName = '{instance.EntityType.Name}'");
}