C# 实体框架-版本属性名称
我正在搜索通过ObjectContext在运行时获得并发固定属性名,但我找不到任何属性或方法能够提供此信息C# 实体框架-版本属性名称,c#,entity-framework-4,entity,C#,Entity Framework 4,Entity,我正在搜索通过ObjectContext在运行时获得并发固定属性名,但我找不到任何属性或方法能够提供此信息 是否有办法将实体属性名称设置为“concurrencyMode=fixed”您可以通过查询概念模型获得这些属性的列表: context.MetadataWorkspace.GetItemCollection(DataSpace.CSpace) .OfType<EntityType>() .SelectMany(entityType => entityTyp
是否有办法将实体属性名称设置为“concurrencyMode=fixed”您可以通过查询概念模型获得这些属性的列表:
context.MetadataWorkspace.GetItemCollection(DataSpace.CSpace)
.OfType<EntityType>()
.SelectMany(entityType => entityType.Properties)
.OfType<EdmProperty>()
.Where(ep => ep.TypeUsage.Facets.Any(f => f.Name == "ConcurrencyMode"
&& (EdmConcurrencyMode)f.Value == EdmConcurrencyMode.Fixed))
.Select(ep => new
{
Type = ep.DeclaringType.Name,
Property = ep.Name,
DateType = ep.TypeUsage.EdmType.Name
})
context.MetadataWorkspace.GetItemCollection(DataSpace.CSpace)
第()类
.SelectMany(entityType=>entityType.Properties)
第()类
.Where(ep=>ep.TypeUsage.Facets.Any(f=>f.Name==“ConcurrencyMode”
&&(EdmConcurrencyMode)f.Value==EdmConcurrencyMode.Fixed)
.选择(ep=>新建
{
Type=ep.DeclaringType.Name,
Property=ep.Name,
DateType=ep.TypeUsage.EdmType.Name
})
我想这个帖子包含了你问题的答案: