且构网

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

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

更新时间:2023-01-01 08:20:25

比上面容易得多,并且不需要反射. 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();