给定实体类型,如何通过内省CSpace的MetadataWorkspace在运行时发现该实体类型的属性的ConcurrencyMode? 谢谢。
答案 0 :(得分:1)
您可以使用TypeUsage.Facets
[EntityContext] etContext = new [EntityContext]();
var csdl = etContext.MetadataWorkspace.GetItemCollection(DataSpace.CSpace);
var entity = csdl.GetItems<EntityType>().Where(e => e.Name = [EntityType]).SingleOrDefault();
var edmProperty = entity.Properties.Where(p => p.Name == [PropertyName]).SingleOrDefault();
var mode = edmProperty.TypeUsage.Facets.Where(f => f.Name == "ConcurrencyMode").SingleOrDefault();