本文整理汇总了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);
}
示例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;
}
示例3: GetValueGenerationStrategy
// TODO: Move to metadata API?
private NpgsqlValueGenerationStrategy? GetValueGenerationStrategy(IProperty property) => property.Npgsql().ValueGenerationStrategy;
示例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;
}
示例5: GetColumnName
public override string GetColumnName(IProperty property)
{
Check.NotNull(property, nameof(property));
return property.Npgsql().Column;
}
示例6: GetPropertyExtensions
public override IRelationalPropertyExtensions GetPropertyExtensions(IProperty property)
{
Check.NotNull(property, nameof(property));
return property.Npgsql();
}