且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linq:获取 DataContext 中所有表的列表

更新时间:2023-01-01 08:34:07

它比上面的要容易得多,而且不需要反思.Linq to SQL 有一个 Mapping 属性,您可以使用它来获取所有表的枚举.

It's much easier than above and no reflection required. Linq to SQL has a Mapping property that you can use to get an enumeration of all the tables.

context.Mapping.GetTables();