本文整理汇总了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");
}
}
示例2: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.PropertyType.Equals(typeof(IGeometry)))
{
instance.CustomType<GeometryType>();
instance.CustomSqlType("Geography");
}
}
示例3: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Property.ToString().Contains("String"))
{
instance.CustomType("StringClob");
instance.CustomSqlType("NTEXT");
//instance.Length(4001);
}
}
示例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();
}
示例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 + ")");
}
示例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" );
}
}
示例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");
}
}
示例8: Apply
public void Apply(IPropertyInstance instance)
{
instance.CustomSqlType("tinyint");
}
示例9: Apply
public void Apply(IPropertyInstance instance)
{
if (instance.Type == typeof(DateTime))
instance.CustomSqlType("datetime2");
}
示例10: Apply
public void Apply(IPropertyInstance instance)
{
instance.Length(2147483647);
instance.CustomSqlType("varbinary(MAX)");
}
示例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);
}
示例12: Apply
public void Apply(IPropertyInstance instance)
{
instance.CustomSqlType("numeric");
instance.Precision(10);
instance.Scale(2);
}