本文整理汇总了C#中IProperty.Relational方法的典型用法代码示例。如果您正苦于以下问题:C# IProperty.Relational方法的具体用法?C# IProperty.Relational怎么用?C# IProperty.Relational使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProperty
的用法示例。
在下文中一共展示了IProperty.Relational方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTypeMapping
public virtual RelationalTypeMapping GetTypeMapping(IProperty property)
=> GetTypeMapping(
property.Relational().ColumnType,
property.Relational().Column,
property.ClrType.UnwrapNullableType(),
property.IsKey() || property.IsForeignKey(),
property.IsConcurrencyToken);
示例2: Diff
protected override IEnumerable<MigrationOperation> Diff(IProperty source, IProperty target)
{
var operations = base.Diff(source, target).ToList();
var sourceValueGenerationStrategy = GetValueGenerationStrategy(source);
var targetValueGenerationStrategy = GetValueGenerationStrategy(target);
var alterColumnOperation = operations.OfType<AlterColumnOperation>().SingleOrDefault();
if (alterColumnOperation == null
&& (source.SqlServer().ComputedExpression != target.SqlServer().ComputedExpression
|| sourceValueGenerationStrategy != targetValueGenerationStrategy))
{
alterColumnOperation = new AlterColumnOperation
{
Schema = source.EntityType.Relational().Schema,
Table = source.EntityType.Relational().Table,
Name = source.Relational().Column,
Type = TypeMapper.GetTypeMapping(target).StoreTypeName,
IsNullable = target.IsNullable,
DefaultValue = target.Relational().DefaultValue,
DefaultExpression = target.Relational().DefaultExpression
};
operations.Add(alterColumnOperation);
}
if (alterColumnOperation != null)
{
if (targetValueGenerationStrategy == SqlServerValueGenerationStrategy.Identity)
{
alterColumnOperation[SqlServerAnnotationNames.Prefix + SqlServerAnnotationNames.ValueGeneration] =
targetValueGenerationStrategy.ToString();
}
if (target.SqlServer().ComputedExpression != null)
{
alterColumnOperation[SqlServerAnnotationNames.Prefix + SqlServerAnnotationNames.ColumnComputedExpression] =
target.SqlServer().ComputedExpression;
alterColumnOperation.IsDestructiveChange |= source.SqlServer().ComputedExpression == null;
}
}
return operations;
}
示例3: MapPropertyType
public virtual RelationalTypeMapping MapPropertyType(IProperty property)
{
Check.NotNull(property, nameof(property));
RelationalTypeMapping mapping = null;
var typeName = property.Relational().ColumnType;
if (typeName != null)
{
var paren = typeName.IndexOf("(", StringComparison.Ordinal);
SimpleNameMappings.TryGetValue((paren >= 0 ? typeName.Substring(0, paren) : typeName).ToLowerInvariant(), out mapping);
}
return mapping
?? (SimpleMappings.TryGetValue(property.ClrType.UnwrapEnumType().UnwrapNullableType(), out mapping)
? mapping
: GetCustomMapping(property));
}
示例4: Extensions
public IRelationalPropertyExtensions Extensions(IProperty property) => property.Relational();
示例5: GetPropertyExtensions
public override IRelationalPropertyExtensions GetPropertyExtensions(IProperty property)
{
return property.Relational();
}