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

Query over multipule tables to return Typed class

1 Answer 31 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ubuntu
Top achievements
Rank 1
Ubuntu asked on 23 Apr 2011, 02:28 PM
Dear All,

I have a query that executes over three different tables and I need to return the result as an Entities.

I started by creating a custom class to hold my result from the query

Then I created an IQueryable method with the correct linq query to return the result.

Here a sample of the method :
public IQueryable<summaryview> Getsummery_View(int Status)
{
    var results = (from Summary in DataContext.summeries
        let details = Summary.parents.Where(o => o.id == Summary.id)
        join Period in DataContext.Periods on Summary.periodid equals Period.periodid
        where Summary.status == Status
        && Summary.Transdate >= Period.datef
        && Summary.Transdate <= Period.datet
    select new summaryview
      {
        period = Summary.periodid,
        number = Summary.number,
        dnumber = Summary.dnumber,
        discriptor = Summary.discriptor,
        transdate = Summary.transdate,
        notes = Summary.notes
      });
return result;
}

I complied & run the application, when I try to load the query I got an exception says:

Part of the exception:
Load operation failed for query 'Getsummery_View'. An exception occured during the execution of '
Extent<RIAServicesORM.Web.summery>.Select(Summary => new <>f__AnonymousType0`2(Summary = Summary,

What am I doing wrong, this was working fine with EF4.

Any help !!

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 27 Apr 2011, 10:48 PM
Hi Ubuntu,

The exception you provided is unfortunately not very descriptive. Could you please debug again and look for an inner exception which could unveil additional details about the problem? You can also try to execute a simpler query, without the let and join statements and see if it works. If it does, this would mean that the problem is in the linq query itself, perhaps this is a case which is not supported by OpenAccess yet.

All the best,
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
Getting Started
Asked by
Ubuntu
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or