简体   繁体   中英

How to build dynamic Linq query ?

What can I do to dynamically create queries when I do have this type of string ?

I want to transform this :

SELECT [Extent1].[TASK_ORDER] AS [TASK_ORDER] FROM [dbo].[CR_TASK] AS [Extent1]

to this :

context.CR_TASK.Where(a => a.TASK_NO == id).Select(a => a.TASK_NO);

您可以轻松使用动态linqhttp://dynamiclinq.codeplex.com/ ),它能够对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