views:

889

answers:

3

is there any way to retrieve mapping table name for an Entity in Entity-framework in program? I know you can use .ToTraceString() to get the command text and then extract the table name, but ToTraceString() method is very slow. is there any other way like using ObjectContext.MetadataWorkspace? Thanks

A: 

Thanks for your answer, but the code above works for LINQ to SQL, it does not work for Entity framework, because the entity classes in EF dont have table name attribute.the mapping information is in edmx file in XML.

A: 

You can use <dataContext>.<EntityName>.CommandText property to get the name of the Entity. Maybe that helps...

Andreas
Nope, you will only get the ObjectQuery object name this way.
Jader Dias
+1  A: 

In the EF v1.0 ToTraceString is the only way.

Jader Dias
As far as I could find on the internet
Jader Dias