How to get the the Schama.TableName in EF 6 database-first?
问题 I'm using EF 6 database-first.. I use this method to get the name of the table: private static string GetTableName(ObjectContext context, Type entityType) { string entityTypeName = entityType.Name; EntityContainer container = context.MetadataWorkspace.GetEntityContainer(context.DefaultContainerName, DataSpace.CSpace); string tableName = (from meta in container.BaseEntitySets where meta.ElementType.Name == entityTypeName select meta.Name).First(); return tableName; } but it only returns the