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


C# IPropertyInstance.Length方法代码示例

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


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

示例1: Apply

        /// <summary>
        /// Applies length based on byte[].
        /// </summary>
        /// <param name="instance">The instance.</param>
        public void Apply( IPropertyInstance instance )
        {
            var lengthAttributes = instance.Property.MemberInfo.GetCustomAttributes (
                typeof( ColumnLengthAttribute ), false );

            if ( lengthAttributes.Length > 0 )
            {
                var columnLength = ( ColumnLengthAttribute )lengthAttributes[0];
                instance.Length ( columnLength.Length );
            }
            else
            {
                instance.Length ( ByteArrayDefaultLength );
            }
        }
开发者ID:divyang4481,项目名称:REM,代码行数:19,代码来源:ByteArrayColumnSizeConvention.cs

示例2: ApplyStringLength

 private static void ApplyStringLength(int stringLength, IPropertyInstance target)
 {
     if (stringLength > 0)
     {
         target.Length(stringLength);
     }
 }
开发者ID:DerAlbertCom,项目名称:FluentMetadata,代码行数:7,代码来源:FluentMetaDataConvention.cs

示例3: Apply

 public void Apply(IPropertyInstance instance)
 {
     if (instance.Name=="Name")
     {
         instance.Length(100);
         instance.Not.Nullable();
     }
 }
开发者ID:snahider,项目名称:TiendaVirtual,代码行数:8,代码来源:PropertyConvention.cs

示例4: Apply

 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.PropertyType != typeof(string))
         return;
     var memberInfo = instance.Property.MemberInfo;
     var stringLengthAttribute = memberInfo.GetCustomAttribute<StringLengthAttribute>();
     var isDbLengthAttribute = memberInfo.GetCustomAttribute<IsDBLengthAttribute>();
     if (stringLengthAttribute != null && isDbLengthAttribute != null)
     {
         instance.Length(stringLengthAttribute.MaximumLength);
     }
     else
     {
         instance.CustomType<VarcharMax>();
         instance.Length(4001);
     }
 }
开发者ID:neozhu,项目名称:MrCMS,代码行数:17,代码来源:StringLengthConvention.cs

示例5: Apply

        public void Apply(IPropertyInstance target)
        {
            var attribute =
                Attribute.GetCustomAttribute(target.Property.MemberInfo, typeof(StringLengthAttribute)) as
                StringLengthAttribute;

            if (attribute != null)
            {
                target.Length(attribute.MaximumLength);
            }
        }
开发者ID:rag2111,项目名称:Hexa.Core,代码行数:11,代码来源:StringLength.cs

示例6: StringConvention

 private static void StringConvention(IPropertyInstance instance)
 {
     if (instance.Type == typeof (String))
     {
         object[] attributes = instance.EntityType.GetProperty(instance.Name)
                                 .GetCustomAttributes(typeof (LengthAttribute), false);
         if (attributes.Length > 0)
         {
             LengthAttribute length = attributes[0] as LengthAttribute;
             if (length != null) instance.Length(length.Length);
         }
     }
 }
开发者ID:vebin,项目名称:BDDD,代码行数:13,代码来源:CustomPropertyConvention.cs

示例7: Apply

        /// <summary>
        /// Sets the length of the property based on the Name.
        /// </summary>
        /// <param name="propertyInstance">The property instance.</param>
        /// <param name="columnName">Name of the column.</param>
        public static void Apply( IPropertyInstance propertyInstance, string columnName )
        {
            var lengthAttributes = propertyInstance.Property.MemberInfo.GetCustomAttributes (
                typeof( ColumnLengthAttribute ), false );

            if ( lengthAttributes.Length > 0 )
            {
                var columnLength = ( ColumnLengthAttribute )lengthAttributes[0];
                propertyInstance.Length ( columnLength.Length );
            }
            else if ( columnName.EndsWith ( "Code" ) )
            {
                propertyInstance.Length ( CodeLength );
            }
            else if ( columnName.EndsWith ( "Number" ) )
            {
                propertyInstance.Length ( NumberLength );
            }
            else if ( columnName.EndsWith ( "Name" ) )
            {
                propertyInstance.Length ( NameLength );
            }
            else if ( columnName.EndsWith ( "Note" ) )
            {
                propertyInstance.Length ( NoteLength );
            }
            else if ( columnName.EndsWith ( "Description" ) )
            {
                propertyInstance.Length ( DescriptionLength );
            }
            else if ( columnName.EndsWith ( "Identifier" ) )
            {
                propertyInstance.Length ( IdentifierLength );
            }
            else if ( columnName.EndsWith ( "Value" ) )
            {
                propertyInstance.Length ( ValueLength );
            }
        }
开发者ID:divyang4481,项目名称:REM,代码行数:44,代码来源:StringColumnSizeConvention.cs

示例8: Apply

 public void Apply(IPropertyInstance propertyMapping)
 {
     try
     {
         if (propertyMapping.Type == typeof(byte[]))
         {
             propertyMapping.Length(int.MaxValue);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
     }
 }
开发者ID:codeprogression,项目名称:Fluently-Persistent,代码行数:14,代码来源:ByteArrayAsVarBinary.cs

示例9: Apply

        public void Apply(IPropertyInstance instance)
        {
            var meta = QueryFluentMetadata.FindMetadataFor(instance.EntityType, instance.Property.Name);
            if (meta != null)
            {
                if (meta.Required.HasValue && meta.Required.Value)
                {
                    instance.Not.Nullable();
                }

                var maxLength = meta.GetMaximumLength();
                if (maxLength.HasValue && maxLength.Value > 0)
                {
                    instance.Length(maxLength.Value);
                }
            }
        }
开发者ID:forger,项目名称:FluentMetadata,代码行数:17,代码来源:FluentMetaDataConvention.cs

示例10: Apply

        public void Apply(IPropertyInstance instance)
        {

            if (instance.EntityType.Name == "AuditLog")
                instance.Length(10000);


            //if (instance.Name == "OriginalValue")
            //{
            //    instance.Length(10000);
            //}

            //if (instance.Name == "NewValue")
            //{
            //    instance.Length(10000);
            //}


        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:19,代码来源:AuditLogConvention.cs

示例11: Apply

 public void Apply(IPropertyInstance target)
 {
     target.Length(20);
 }
开发者ID:umittal,项目名称:MunimJi,代码行数:4,代码来源:StringConvention.cs

示例12: Apply

 public void Apply(IPropertyInstance propertyMapping)
 {
     propertyMapping.Length(4000);
 }
开发者ID:codeprogression,项目名称:Fluently-Persistent,代码行数:4,代码来源:DescriptionIsLongString.cs

示例13: Apply

 public void Apply(IPropertyInstance instance)
 {
     instance.Length(short.MaxValue);
 }
开发者ID:Eskat0n,项目名称:Frameplate,代码行数:4,代码来源:PropertyLengthConvention.cs

示例14: Apply

 public void Apply(IPropertyInstance instance)
 {
     instance.Length(Enum.GetNames(instance.Property.PropertyType).Max(name => name.Length));
     instance.CustomType(typeof(string));
 }
开发者ID:perceptal,项目名称:starter.net,代码行数:5,代码来源:EnumConvention.cs

示例15: Apply

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


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