I would like to get the KeyMembers
where I have set in the Edmx the StoreGeneratedPattern
to Identity
is there a way to do this?
I
The store-generated pattern is in the SSDL content of the EF model. Here's an example of how you can get the properties with identity specification:
var items = oc.MetadataWorkspace.GetItems(DataSpace.SSpace).OfType();
foreach (var entityType in items)
{
var props = string.Join(",", entityType.Properties
.Where(x => x.IsStoreGeneratedIdentity));
Trace.WriteLine(string.Format("{0}: {1}", entityType.Name, props));
}
(where oc
is an ObjectContext
)