本文整理汇总了C#中IPropertyInstance类的典型用法代码示例。如果您正苦于以下问题:C# IPropertyInstance类的具体用法?C# IPropertyInstance怎么用?C# IPropertyInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPropertyInstance类属于命名空间,在下文中一共展示了IPropertyInstance类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApplyRequired
private static void ApplyRequired(bool required, IPropertyInstance target)
{
if (required)
{
target.Not.Nullable();
}
}
开发者ID:DerAlbertCom,项目名称:FluentMetadata,代码行数:7,代码来源:FluentMetaDataConvention.cs
示例2: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.PropertyType.Equals(typeof(IGeometry)))
{
instance.CustomType<SqLiteGeometryType>();
}
}
开发者ID:matanzg,项目名称:codecovered,代码行数:7,代码来源:SqLiteGeometryTypeConvention.cs
示例3: Apply
public void Apply(IPropertyInstance target)
{
var att = Attribute.GetCustomAttribute(target.Property.MemberInfo, typeof(RequiredAttribute)) as RequiredAttribute;
if (att != null)
target.Not.Nullable();
}
开发者ID:rretamal,项目名称:Hexa.Core,代码行数:7,代码来源:NotNullable.cs
示例4: Apply
/// <summary>
/// Applies Index based on type.
/// </summary>
/// <param name="instance">The instance.</param>
public void Apply( IPropertyInstance instance )
{
CreateUniqeIndexIfIndicated ( instance.Property, instance.Unique, instance.UniqueKey );
var sourceName = instance.EntityType.Name;
var propertyName = instance.Property.Name;
if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType ) )
{
sourceName += "Lkp";
}
if ( typeof( ILookup ).IsAssignableFrom ( instance.Property.PropertyType ) )
{
propertyName += "Lkp";
}
var indexAttribute = instance.Property.MemberInfo.GetCustomAttributes (
typeof( NaturalIndexAttribute ), false );
if ( indexAttribute.Length > 0 )
{
var indexName = string.Format ( "{0}_{1}_IDX", sourceName, propertyName );
instance.Index ( indexName );
}
}
开发者ID:divyang4481,项目名称:REM,代码行数:30,代码来源:IndexConvention.cs
示例5: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.IsNotNull())
{
instance.Column(instance.Property.Name.ToCamelCase());
}
}
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:7,代码来源:ColumnNameConvention.cs
示例6: Apply
public void Apply(IPropertyInstance instance)
{
if (Nullable.GetUnderlyingType(instance.Property.PropertyType) == null)
{
instance.Not.Nullable();
}
}
开发者ID:pleb,项目名称:Chillow,代码行数:7,代码来源:ValueTypeNullableConvention.cs
示例7: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property != null)
{
instance.Property.Name.Camelize();
}
}
开发者ID:sam-adam,项目名称:LearningDDD,代码行数:7,代码来源:ColumnNameConvention.cs
示例8: ApplyStringLength
private static void ApplyStringLength(int stringLength, IPropertyInstance target)
{
if (stringLength > 0)
{
target.Length(stringLength);
}
}
开发者ID:DerAlbertCom,项目名称:FluentMetadata,代码行数:7,代码来源:FluentMetaDataConvention.cs
示例9: Apply
public void Apply(IPropertyInstance instance)
{
var abbreviation = AttributeHelper.GetTypeAttribute<AbbreviationAttribute>(instance.EntityType);
var columnName = abbreviation == null
? instance.Name
: abbreviation.Abbreviation + instance.Name;
instance.Column(columnName.EscapeColumnName());
}
开发者ID:seatwave,项目名称:Quarks,代码行数:8,代码来源:Column.cs
示例10: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.Name == "Guid" && instance.Property.PropertyType == typeof (Guid))
{
instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
}
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:RootGuidConvention.cs
示例11: Apply
public void Apply(IPropertyInstance instance)
{
var attribute = instance.Property.MemberInfo.GetCustomAttribute<NotNullableAttribute>();
if (attribute != null)
{
instance.Not.Nullable();
}
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:NotNullableAttributeConvention.cs
示例12: 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
示例13: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Type == typeof (decimal) || Nullable.GetUnderlyingType(instance.Property.PropertyType) == typeof(decimal))
{
instance.Precision(27);
instance.Scale(15);
}
}
开发者ID:brucewu16899,项目名称:lacjam,代码行数:8,代码来源:DecimalConvention.cs
示例14: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Name=="Name")
{
instance.Length(100);
instance.Not.Nullable();
}
}
开发者ID:snahider,项目名称:TiendaVirtual,代码行数:8,代码来源:PropertyConvention.cs
示例15: 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
示例16: Apply
/// <summary>
/// Applies the specified instance.
/// </summary>
/// <param name="instance">The instance.</param>
public void Apply(IPropertyInstance instance)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
instance.CustomType(instance.Property.PropertyType);
}
开发者ID:Mike343,项目名称:Netcoders,代码行数:13,代码来源:EnumConvention.cs
示例17: 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
示例18: Apply
/// <summary>
/// The convention that is applied to a <see cref = "IPropertyInstance" /> when the criteria from the Accept method is meet.
/// </summary>
/// <param name="instance">An <see cref = "IPropertyInstance" /> to apply the convention to.</param>
public void Apply(IPropertyInstance instance)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
instance.CustomType<DateTimeOffsetSplitType>();
}
开发者ID:MatthewRudolph,项目名称:Airy,代码行数:13,代码来源:DateTimeOffsetSplitTypeConvention.cs
示例19: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.MemberInfo.IsDefined(typeof(RequiredAttribute), false))
instance.Not.Nullable();
else if (Nullable.GetUnderlyingType(instance.Property.PropertyType) != null || instance.Property.PropertyType == typeof(string))
instance.Nullable();
else
instance.Not.Nullable();
}
开发者ID:Ridermansb,项目名称:GenerateIdDesignerProblem,代码行数:9,代码来源:NullablesConvention.cs
示例20: Apply
/// <summary>
/// Applies this column name convention to the specified <see cref = "IPropertyInstance" />.
/// </summary>
/// <param name="instance">An <see cref = "IPropertyInstance" />.</param>
public void Apply(IPropertyInstance instance)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
instance.Column(instance.Property.Name);
}
开发者ID:MatthewRudolph,项目名称:Airy,代码行数:13,代码来源:ColumnNameConvention.cs
注:本文中的IPropertyInstance类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论