本文整理汇总了C#中IPropertyInstance类的典型用法代码示例。如果您正苦于以下问题:C# IPropertyInstance类的具体用法?C# IPropertyInstance怎么用?C# IPropertyInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPropertyInstance类属于命名空间,在下文中一共展示了IPropertyInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyRequired
private static void ApplyRequired(bool required, IPropertyInstance target)
{
if (required)
{
target.Not.Nullable();
}
}
示例2: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.PropertyType.Equals(typeof(IGeometry)))
{
instance.CustomType<SqLiteGeometryType>();
}
}
示例3: Apply
public void Apply(IPropertyInstance target)
{
var att = Attribute.GetCustomAttribute(target.Property.MemberInfo, typeof(RequiredAttribute)) as RequiredAttribute;
if (att != null)
target.Not.Nullable();
}
示例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 );
}
}
示例5: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.IsNotNull())
{
instance.Column(instance.Property.Name.ToCamelCase());
}
}
示例6: Apply
public void Apply(IPropertyInstance instance)
{
if (Nullable.GetUnderlyingType(instance.Property.PropertyType) == null)
{
instance.Not.Nullable();
}
}
示例7: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property != null)
{
instance.Property.Name.Camelize();
}
}
示例8: ApplyStringLength
private static void ApplyStringLength(int stringLength, IPropertyInstance target)
{
if (stringLength > 0)
{
target.Length(stringLength);
}
}
示例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());
}
示例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));
}
}
示例11: Apply
public void Apply(IPropertyInstance instance)
{
var attribute = instance.Property.MemberInfo.GetCustomAttribute<NotNullableAttribute>();
if (attribute != null)
{
instance.Not.Nullable();
}
}
示例12: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.PropertyType.Equals(typeof(IGeometry)))
{
instance.CustomType<GeometryType>();
instance.CustomSqlType("Geography");
}
}
示例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);
}
}
示例14: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Name=="Name")
{
instance.Length(100);
instance.Not.Nullable();
}
}
示例15: Apply
public void Apply(IPropertyInstance instance)
{
if (typeof(IGeometry).IsAssignableFrom(instance.Property.PropertyType))
{
instance.CustomType(typeof(GeographyType));
instance.CustomSqlType("GEOGRAPHY");
}
}