0

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);

2

1 Answer 1

1

You could use dynamic linq (http://dynamiclinq.codeplex.com/) easily which is capable of doing all dynamic operations on linq and strings

Sign up to request clarification or add additional context in comments.

3 Comments

how can we use this reference ?
Download from the site, extract it, add the library (dll) into your project, see the sample (on the site), write your queries.
Or you can get it using NuGet nuget.org/packages/System.Linq.Dynamic.Library. This is more current and if you use .NET 4.0+, it adds support for the dynamic keyword.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.