简体   繁体   中英

using reflection and linq for dynamic linq

I wrote this code:

string Dcname = "DataClasses1DataContext";
string TableName = "Order";
var dc =(DataContext)Activator.CreateInstance(typeof(DataContext), Dcname);
ITable mytbl=(ITable)dc.GetType().GetProperty(TableName).GetValue(dc,null);

I want to query mytable using linq or Expression Tree.

How I can do this?

我认为您需要针对这种情况使用Linq编译器

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM