1

我正在寻找在运行时通过 ObjectContext 获取并发固定属性名称,但我没有找到任何属性或方法能够为我提供此信息。

有没有办法让实体属性名称设置为“concurrencyMode=fixed”?

4

1 回答 1

0

您可以通过查询概念模型来获取这些属性的列表:

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 
                    })
于 2013-05-21T15:23:08.773 回答