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


C# IPropertyInstance.CustomSqlType方法代码示例

本文整理汇总了C#中IPropertyInstance.CustomSqlType方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertyInstance.CustomSqlType方法的具体用法?C# IPropertyInstance.CustomSqlType怎么用?C# IPropertyInstance.CustomSqlType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPropertyInstance的用法示例。


在下文中一共展示了IPropertyInstance.CustomSqlType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Apply

 public void Apply(IPropertyInstance instance)
 {
     if (typeof(IGeometry).IsAssignableFrom(instance.Property.PropertyType))
     {
         instance.CustomType(typeof(GeographyType));
         instance.CustomSqlType("GEOGRAPHY");
     }
 }
开发者ID:theriddlebrothers,项目名称:Honeypot,代码行数:8,代码来源:GeographyConvention.cs

示例2: Apply

 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.PropertyType.Equals(typeof(IGeometry)))
     {
         instance.CustomType<GeometryType>();
         instance.CustomSqlType("Geography");
     }
 }
开发者ID:matanzg,项目名称:codecovered,代码行数:8,代码来源:SqlServer2008GeographyTypeConvention.cs

示例3: Apply

 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.ToString().Contains("String"))
     {
         instance.CustomType("StringClob");
         instance.CustomSqlType("NTEXT");
         //instance.Length(4001);
     }
 }
开发者ID:bibliopedia,项目名称:bibliopedia,代码行数:9,代码来源:Conventions.cs

示例4: Apply

        /// <summary>
        /// Conventions for handling string properties in FluentNHibernate. If the property name contains any of the 
        /// configured strings in BigStringPropertyNames, then the SQL type of the property is set to NVARCHAR(MAX); the
        /// SQL type can be overridden by the BigStringSqlType configuration key. Also adds a unique constraint for
        /// domain ids and external ids.
        /// </summary>
        public void Apply(IPropertyInstance instance)
        {
            // If property name contains one of the configured values, then use use special SQL type for column
            string name = instance.Name;
            if (bigStringPropertyNames.FirstOrDefault(name.Contains) != null) instance.CustomSqlType(bigStringSqlType);

            // Add unique constraint for domain ids and external ids
            if (name.Equals("DomainId")) instance.Unique();
            if (name.Equals("ExternalId")) instance.Unique();
        }
开发者ID:shj333,项目名称:dotnet_utils,代码行数:16,代码来源:StringConvention.cs

示例5: Apply

        public void Apply(IPropertyInstance instance)
        {
            int length = 255;
            var instanceProperties = instance as IPropertyInspector;
            if (instanceProperties != null)
            {
                var existingLength = instanceProperties.Length;
                length = existingLength == 0 ? length : existingLength;
            }

            instance.CustomSqlType("VarChar(" + length + ")");
        }
开发者ID:pkdevboxy,项目名称:chocolatey.web,代码行数:12,代码来源:StringVarCharConvention.cs

示例6: Apply

        /// <summary>
        /// Applies CustomSqlType for Date and time columns.
        /// </summary>
        /// <param name="propertyInstance">The property instance.</param>
        /// <param name="columnName">Name of the column.</param>
        public static void Apply( IPropertyInstance propertyInstance, string columnName )
        {
            columnName = columnName.ToLower ();

            if ( columnName.EndsWith ( "timestamp" ) )
            {
                propertyInstance.CustomSqlType ( "datetimeoffset" );
            }
            else if ( columnName.EndsWith ( "datetime" ) )
            {
                //TODO: Property ending with DateTime will use datetimeoffset in future.
                //     Do not remove this condition or it'll pick Time as its type from the next condition
                //instance.CustomSqlType ( "datetimeoffset" );
            }
            else if ( columnName.EndsWith ( "date" ) )
            {
                propertyInstance.CustomSqlType ( "date" );
            }
            else if ( columnName.EndsWith ( "time" ) )
            {
                propertyInstance.CustomSqlType ( "time" );
            }
        }
开发者ID:divyang4481,项目名称:REM,代码行数:28,代码来源:DateTimeColumnTypeConvention.cs

示例7: Apply

        public void Apply(IPropertyInstance instance)
        {
            // Default behaviour: any column can be null

            if (instance.Property.MemberInfo.GetAttribute<AllowNullAttribute>() != null)
            {
                instance.Nullable();
            }
            else
            {
                instance.Not.Nullable();
            }

            if (instance.Type == typeof(DateTime))
            {
                instance.CustomSqlType("DateTime2");
            }

            if (instance.Type == typeof(DateTime?))
            {
                instance.Nullable();
                instance.CustomSqlType("DateTime2");
            }
        }
开发者ID:dwdkls,项目名称:pizzamvc,代码行数:24,代码来源:PropertyConvention.cs

示例8: Apply

		public void Apply(IPropertyInstance instance)
		{
			instance.CustomSqlType("tinyint");
		}
开发者ID:seatwave,项目名称:Quarks,代码行数:4,代码来源:CustomSqlTypeEnum.cs

示例9: Apply

 public void Apply(IPropertyInstance instance)
 {
     if (instance.Type == typeof(DateTime))
         instance.CustomSqlType("datetime2");
 }
开发者ID:jladuval,项目名称:CQRSTemplate,代码行数:5,代码来源:UseNewSqlDateTime2TypeConvention.cs

示例10: Apply

 public void Apply(IPropertyInstance instance)
 {
     instance.Length(2147483647);
     instance.CustomSqlType("varbinary(MAX)");
 }
开发者ID:theriddlebrothers,项目名称:Honeypot,代码行数:5,代码来源:BinaryColumnLengthConvention.cs

示例11: Apply

 /// <summary>
 /// The SQL type is set by default to TINYINT but this can be overridden by the EnumSqlType configuration key.
 /// </summary>
 public void Apply(IPropertyInstance target)
 {
     target.CustomType(target.Property.PropertyType);
     target.CustomSqlType(enumSqlType);
 }
开发者ID:shj333,项目名称:dotnet_utils,代码行数:8,代码来源:EnumConvention.cs

示例12: Apply

 public void Apply(IPropertyInstance instance)
 {
     instance.CustomSqlType("numeric");
     instance.Precision(10);
     instance.Scale(2);
 }
开发者ID:codeprogression,项目名称:Fluently-Persistent,代码行数:6,代码来源:NumericConvention.cs


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