当前位置: 首页>>代码示例>>C#>>正文


C# IIdentityInstance类代码示例

本文整理汇总了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();
 }
开发者ID:vebin,项目名称:BDDD,代码行数:7,代码来源:CustomPrimaryKeyConvention.cs

示例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());
 }
开发者ID:brucewu16899,项目名称:lacjam,代码行数:7,代码来源:PrimaryKeyConvention.cs

示例3: Apply

        public void Apply(IIdentityInstance instance)
        {
            instance.Column("Id");
            instance.UnsavedValue("0");

            // instance.GeneratedBy.HiLo("1000");
        }
开发者ID:seif,项目名称:Northwind,代码行数:7,代码来源:PrimaryKeyConvention.cs

示例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));
        }
开发者ID:Eskat0n,项目名称:Frameplate,代码行数:8,代码来源:PrimaryKeyConvention.cs

示例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");
        }
开发者ID:MatthewRudolph,项目名称:Airy,代码行数:13,代码来源:PrimaryKeyConvention.cs

示例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();
     }
 }
开发者ID:realzhaorong,项目名称:vocadb,代码行数:9,代码来源:ClassConventions.cs

示例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());
		}
开发者ID:seatwave,项目名称:Quarks,代码行数:9,代码来源:Column.cs

示例8: Apply

 public void Apply(IIdentityInstance instance)
 {
     if (typeof(ISagaEntity).IsAssignableFrom(instance.EntityType))
     {
         instance.GeneratedBy.Assigned();
     }
     else
         instance.GeneratedBy.GuidComb();
 }
开发者ID:togakangaroo,项目名称:NServiceBus,代码行数:9,代码来源:IdShouldBeAssignedConvention.cs

示例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);
        }
开发者ID:evgenyk,项目名称:Brick.FluentNHibernate.Conventions,代码行数:10,代码来源:PrimaryKeyConvention.cs

示例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)));
     }
 }
开发者ID:zirain,项目名称:MiniOrchard,代码行数:13,代码来源:HiLoIdConvention.cs

示例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 ) );
        }
开发者ID:divyang4481,项目名称:REM,代码行数:17,代码来源:PrimaryKeyIdConvention.cs

示例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");
            }
        }
开发者ID:marufbd,项目名称:Zephyr.NET,代码行数:15,代码来源:PrimaryKeyConvention.cs

示例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();
        }
开发者ID:evgenyk,项目名称:Brick.FluentNHibernate.Conventions,代码行数:16,代码来源:PrimaryKeyGeneratorConvention.cs

示例14: Apply

 public void Apply(IIdentityInstance instance)
 {
     instance.GeneratedBy.HiLo("1000");
 }
开发者ID:Marceli,项目名称:JQueryGridTest,代码行数:4,代码来源:IdentityConvention.cs

示例15: Apply

 public void Apply(IIdentityInstance instance)
 {
     instance.Column($"{instance.EntityType.Name}ID");
     instance.GeneratedBy.HiLo("[dbo].[Ids]", "NextHigh", "9", $"EntityName = '{instance.EntityType.Name}'");
 }
开发者ID:Adiqq,项目名称:DDD-Playground,代码行数:5,代码来源:SessionFactory.cs


注:本文中的IIdentityInstance类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。