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


C# IProperty.Npgsql方法代码示例

本文整理汇总了C#中IProperty.Npgsql方法的典型用法代码示例。如果您正苦于以下问题:C# IProperty.Npgsql方法的具体用法?C# IProperty.Npgsql怎么用?C# IProperty.Npgsql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProperty的用法示例。


在下文中一共展示了IProperty.Npgsql方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Select

        public override ValueGenerator Select(IProperty property)
        {
            Check.NotNull(property, nameof(property));

            var strategy = property.Npgsql().ValueGenerationStrategy;

            if (property.ClrType.IsInteger()
                && strategy == NpgsqlValueGenerationStrategy.Sequence)
            {
                return _sequenceFactory.Create(property, _cache.GetOrAddSequenceState(property), _connection);
            }

            return _cache.GetOrAdd(property, Create);
        }
开发者ID:Emill,项目名称:Npgsql,代码行数:14,代码来源:NpgsqlValueGeneratorSelector.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.Npgsql().ComputedExpression != target.Npgsql().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 == NpgsqlValueGenerationStrategy.Identity)
                {
                    alterColumnOperation[NpgsqlAnnotationNames.Prefix + NpgsqlAnnotationNames.ValueGeneration] =
                        targetValueGenerationStrategy.ToString();
                }

                if (target.Npgsql().ComputedExpression != null)
                {
                    alterColumnOperation[NpgsqlAnnotationNames.Prefix + NpgsqlAnnotationNames.ColumnComputedExpression] =
                        target.Npgsql().ComputedExpression;
                }
            }

            return operations;
        }
开发者ID:Emill,项目名称:Npgsql,代码行数:42,代码来源:NpgsqlModelDiffer.cs

示例3: GetValueGenerationStrategy

 // TODO: Move to metadata API?
 private NpgsqlValueGenerationStrategy? GetValueGenerationStrategy(IProperty property) => property.Npgsql().ValueGenerationStrategy;
开发者ID:Emill,项目名称:Npgsql,代码行数:2,代码来源:NpgsqlModelDiffer.cs

示例4: Add

        protected override IEnumerable<MigrationOperation> Add(IProperty target)
        {
            var operation = base.Add(target).Cast<AddColumnOperation>().Single();

            var targetValueGenerationStrategy = GetValueGenerationStrategy(target);

            if (targetValueGenerationStrategy == NpgsqlValueGenerationStrategy.Identity)
            {
                operation[NpgsqlAnnotationNames.Prefix + NpgsqlAnnotationNames.ValueGeneration] =
                    targetValueGenerationStrategy.ToString();
            }

            if (target.Npgsql().ComputedExpression != null)
            {
                operation[NpgsqlAnnotationNames.Prefix + NpgsqlAnnotationNames.ColumnComputedExpression] =
                    target.Npgsql().ComputedExpression;
            }

            yield return operation;
        }
开发者ID:Emill,项目名称:Npgsql,代码行数:20,代码来源:NpgsqlModelDiffer.cs

示例5: GetColumnName

        public override string GetColumnName(IProperty property)
        {
            Check.NotNull(property, nameof(property));

            return property.Npgsql().Column;
        }
开发者ID:Emill,项目名称:Npgsql,代码行数:6,代码来源:NpgsqlQueryCompilationContext.cs

示例6: GetPropertyExtensions

        public override IRelationalPropertyExtensions GetPropertyExtensions(IProperty property)
        {
            Check.NotNull(property, nameof(property));

            return property.Npgsql();
        }
开发者ID:Emill,项目名称:Npgsql,代码行数:6,代码来源:NpgsqlModificationCommandBatch.cs


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