I'm using the Entity Framework 4.1 with Code First approach. I'm able to get the storage model types and column names of my entities:
var items = context.ObjectContext.MetadataWorkspace.GetItems<EntityType>(DataSpace.SSpace);
foreach (var i in items)
{
Console.WriteLine("Table Name: {0}", i.Name);
Console.WriteLine("Keys:");
foreach (var key in i.KeyMembers)
Console.WriteLine("\t{0} ({1})", key.Name, key.TypeUsage.EdmType.FullName);
Console.WriteLine("Members:");
foreach (var member in i.Members)
Console.WriteLine("\t{0} ({1})", member.Name, member.TypeUsage.EdmType.FullName);
}
What I need is to get the real table name the entity is mapped to. There are different ways to specify that (by using Fluent-API .ToTable(), DataAnnotation [TableAttribute]).
Is there any common way to achieve this information?