开发者

Get generated tablename for an entity?

If I have the t开发者_StackOverflow社区ype of my entity generated by linq2sql, how can I get the name of the table the entity belongs to? I want the tablename generated by linq2sql not the database table name.


Here is some code that would get all table names from a database. You could easily modify this to get the name of a single table.

var model = yourDBContext.Mapping;
foreach (var mt in model.GetTables())
    Console.WriteLine(mt.TableName);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜