Solved

WCF Data Service Linq select with where condition

Posted on 2012-03-15
5
833 Views
Last Modified: 2012-09-04
Hi

We have WCF Data Service over an huge database. We have problem with performace on select query across WCF Data Service.

How can we create a select using Linq to join two tables (product and category) and also to put filter condition (where) over both tables (where product.name like 'p' and category.name like 'c') and also to provide faster response on selection.

Or a other solution to select data across WCF Data Service with faster response.

Thanks
Petre
0
Comment
Question by:Syberye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37723828
share the query, its always nice to build queries rather than asking LINQ to help you out with that since it will take its own time processing the query and building it for you.

Share the query so that we can fix the performance issue if possible....

For the time bieng here is example of join using LINQ to SQL:-
http://code.msdn.microsoft.com/Linq-to-SQL-Join-Example-02180bee
0
 

Author Comment

by:Syberye
ID: 37724070
Sorry

Now we use like this:

var eData = dataServiceContext.platform_encoding_profiles.Expand("encoding_profiles").Where(finalWhere);

dataServiceContext - is WCF Data Service
finalWhere - is some lamba expresion use "p => p.platform_id == platformID"

the problem is that we have a wery slow answer from a table with 1000 rows

I read tha if I use Linq espresion like, look down, will be more faster.
var a = from p in platforms
      join pe in platform_encoding_profiles on p.id equals pe.platform_id
                where p.name.Contains("a") && pe.active.Equals(1) select new {p.name, pe.active }
I test this Linq select using LinqPad and I get this error: "The method 'Join' is not supported "

What can I do, or how can I do to use this kind of select ower WCF Data Service

Best regards
Petre
0
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 37725263
Can you try this query and see if it works.

var a  = (from p in platforms
            join pe in platform_encoding_profiles
            on p.id equals pe.platform_id
            into pg
           from pe in pg.DefaultifEmpty()
           select new {
                    Name = p.name,
                    State = pe.active
                    }).Where (p.name.Contains("a") && pe.active.Equals(1));
0
 

Accepted Solution

by:
Syberye earned 0 total points
ID: 38349672
We eliminate the WCF service
0
 

Author Closing Comment

by:Syberye
ID: 38362787
not a true solution
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question