Dynamic table name linq-to-sql dynamic LINQ

三世轮回 提交于 2019-12-11 13:31:04

问题


I want to construct my query dynamically based on the contents user has selected, and I want to do this in LINQ-t0-SQL. I have seen this, but I don't want to use SQL statements with datacontext.

On Googling a bit I have a feeling that this can be done using dynamic LINQ. Would someone provide an example of similar scenario with dynamic LINQ?


回答1:


Looks like this is the link you need.
Update. Some details: you can use the SearchType method from the post to obtain a type using the table name and then use Dynamic LINQ to write queries you like.



来源:https://stackoverflow.com/questions/3673603/dynamic-table-name-linq-to-sql-dynamic-linq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!