This is a migrated thread and some comments may be shown as answers.

Dynamic Linq Query Part 2

5 Answers 235 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kyle Pietschmann
Top achievements
Rank 1
Kyle Pietschmann asked on 14 Jan 2010, 07:44 PM
I saw the other thread entitled "Dynamic Linq" (http://www.telerik.com/community/forums/orm/linq-questions/dynamic-linq.aspx), but the syntax just did not work for me.  When I try a where(), there is no overloaded version that takes a string parameter.  Am I missing a reference?

This is how our queries are formatted, and they do work:

IObjectScope

 

scope = ProfitabilityScopeProvider.ObjectScope();

 

 

 

var branchItems = from basedata in scope.Extent<Ge.Wf.Profitability.Data.BaseData>()

 

 

where basedata.BranchNumber == 1234

 

 

select basedata;

But I'd like to use a string for the where clause for more dynamic queries, like is sampled in the examples in the link above.  I tried to modify my query to look like the example from Alexander (of Telerik), but the parameters expected by the where() always include something called a Linq Expressions Predicate.  What do I need to do to make the following work?  Or better yet, in the format above, but with a string for the where clause.

var branchItems = scope.Extent<Ge.Wf.Profitability.Data.BaseData>()
.Where("basedata.Branchname == @0", 1234);

 

5 Answers, 1 is accepted

Sort by
0
Kyle Pietschmann
Top achievements
Rank 1
answered on 14 Jan 2010, 10:36 PM
Got it.  For others who don't realize, you have to download the sample here:
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx

You then take the Dynamic.cs file from the sample and simply add it to your project.  Put

using

 

System.Linq.Dynamic;  at the top of the module and off you go.

 

0
Alexander
Telerik team
answered on 15 Jan 2010, 02:33 PM
Hello Kyle Pietschmann,

I am glad to see that you have found the solution. We are going to publish soon a Code Library project demonstrating the Dynamic Linq integration with OpenAccess. We will notify you in this thread once it is uploaded.

Best wishes,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Bernhard
Top achievements
Rank 2
answered on 19 Mar 2010, 11:39 AM
Hello Alexander,

when do you think could you publish a Code Library project demonstrating the Dynamic Linq integration with OpenAccess?

Thanks & Best regards
Bernhard


0
Alexander
Telerik team
answered on 25 Mar 2010, 08:55 AM
Hi Bernhard,

I am sorry for the delay of this example, we were really occupied with the preparation of the Q1 version but since it is released now we have a bit more time to invest in examples. You can expect this demo to be available next week. Thank you for your patience.

Sincerely yours,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Alexander
Telerik team
answered on 26 Mar 2010, 05:07 PM
Hi Bernhard,

The sample is done and uploaded to our Code library. You can download it from here. Note that you need to install the latest OpenAccess version (Q1 2010) in order to run it. Hope that helps.

Sincerely yours,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
LINQ (LINQ specific questions)
Asked by
Kyle Pietschmann
Top achievements
Rank 1
Answers by
Kyle Pietschmann
Top achievements
Rank 1
Alexander
Telerik team
Bernhard
Top achievements
Rank 2
Share this question
or