简体   繁体   中英

Entity Framework - Version Property Name

I'm searching for getting concurrency fixed property name at runtime through ObjectContext but I don't find any property or method able to give me this information.

Is there some way in order to get entity property name setted with "concurrencyMode=fixed"?

You can get a list of these properties by querying the conceptual model:

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 
                    })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM