本文整理汇总了C#中System.Data.Entity.Core.Metadata.Edm.EdmProperty.IsKey方法的典型用法代码示例。如果您正苦于以下问题:C# EdmProperty.IsKey方法的具体用法?C# EdmProperty.IsKey怎么用?C# EdmProperty.IsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Entity.Core.Metadata.Edm.EdmProperty
的用法示例。
在下文中一共展示了EdmProperty.IsKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Discover
public IConfiguration Discover(EdmProperty property, DbModel model)
{
Debug.Assert(property != null, "property is null.");
Debug.Assert(model != null, "model is null.");
var columnProperty = model.GetColumn(property);
if (property.IsKey() && _identityKeyTypes.Contains(property.PrimitiveType.PrimitiveTypeKind))
{
if (columnProperty.IsStoreGeneratedIdentity)
{
// By convention
return null;
}
}
else if (columnProperty.IsTimestamp())
{
// By convention
return null;
}
else if (columnProperty.StoreGeneratedPattern == StoreGeneratedPattern.None)
{
// Doesn't apply
return null;
}
return new DatabaseGeneratedConfiguration { StoreGeneratedPattern = columnProperty.StoreGeneratedPattern };
}
示例2: Discover
public override IConfiguration Discover(EdmProperty property, DbModel model)
{
Debug.Assert(property != null, "property is null.");
Debug.Assert(model != null, "model is null.");
if (!_lengthTypes.Contains(property.PrimitiveType.PrimitiveTypeKind))
{
// Doesn't apply
return null;
}
if (property.IsMaxLength
|| !property.MaxLength.HasValue
|| (property.MaxLength.Value == 128 && property.IsKey()))
{
// By convention
return null;
}
var configuration = property.PrimitiveType.PrimitiveTypeKind == PrimitiveTypeKind.String
? new MaxLengthStringConfiguration()
: new MaxLengthConfiguration();
configuration.MaxLength = property.MaxLength.Value;
return configuration;
}
示例3: Discover
public IConfiguration Discover(EdmProperty property, DbModel model)
{
Debug.Assert(property != null, "property is null.");
Debug.Assert(model != null, "model is null.");
if (property.Nullable
|| property.PrimitiveType.ClrEquivalentType.IsValueType
|| property.IsKey()
|| model.GetColumn(property).IsTimestamp())
{
// By convention
return null;
}
return new RequiredConfiguration();
}