本文整理汇总了C#中IKey.Npgsql方法的典型用法代码示例。如果您正苦于以下问题:C# IKey.Npgsql方法的具体用法?C# IKey.Npgsql怎么用?C# IKey.Npgsql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKey
的用法示例。
在下文中一共展示了IKey.Npgsql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
protected override IEnumerable<MigrationOperation> Add(IKey target)
{
var operation = base.Add(target)
.Single(o => o is AddPrimaryKeyOperation || o is AddUniqueConstraintOperation);
if (target.Npgsql().IsClustered != null)
{
operation[NpgsqlAnnotationNames.Prefix + NpgsqlAnnotationNames.Clustered] =
target.Npgsql().IsClustered.ToString();
}
yield return operation;
}
示例2: Diff
protected override IEnumerable<MigrationOperation> Diff(IKey source, IKey target)
{
var operations = base.Diff(source, target).ToList();
var addOperation = operations.SingleOrDefault(o => o is AddPrimaryKeyOperation || o is AddUniqueConstraintOperation);
if (addOperation == null)
{
if (source.Npgsql().IsClustered != target.Npgsql().IsClustered)
{
if (source != null
&& !operations.Any(o => o is DropPrimaryKeyOperation || o is DropUniqueConstraintOperation))
{
operations.AddRange(Remove(source));
}
operations.AddRange(Add(target));
}
}
else if (target.Npgsql().IsClustered != null)
{
addOperation[NpgsqlAnnotationNames.Prefix + NpgsqlAnnotationNames.Clustered] =
target.Npgsql().IsClustered.ToString();
}
return operations;
}