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


C# IProperty.Relational方法代码示例

本文整理汇总了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);
开发者ID:aishaloshik,项目名称:EntityFramework,代码行数:7,代码来源:RelationalTypeMapper.cs

示例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;
        }
开发者ID:aishaloshik,项目名称:EntityFramework,代码行数:43,代码来源:SqlServerModelDiffer.cs

示例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));
        }
开发者ID:JamesWang007,项目名称:EntityFramework,代码行数:18,代码来源:RelationalTypeMapper.cs

示例4: Extensions

 public IRelationalPropertyExtensions Extensions(IProperty property) => property.Relational();
开发者ID:aishaloshik,项目名称:EntityFramework,代码行数:1,代码来源:CommandBatchPreparerTest.cs

示例5: GetPropertyExtensions

 public override IRelationalPropertyExtensions GetPropertyExtensions(IProperty property)
 {
     return property.Relational();
 }
开发者ID:thegido,项目名称:EntityFramework,代码行数:4,代码来源:CommandBatchPreparerTest.cs


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