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

System.OutOfMemoryException

1 Answer 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Scott
Top achievements
Rank 2
Scott asked on 09 Aug 2012, 01:10 AM
Why is OpenAccess choking on this LINQ statement? I tried using the FetchStrategy but it was too slow.... and ran too many queries... (which is odd as i thought this was suppose to condense them...) See screenshots of code and table diagrams... I have created a single SQL statement that will retrieve the data needed so I know I can do it manually via a Sproc if necessary... it'd just be nice if I could LINQ and OpenAccess directly instead....

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 13 Aug 2012, 10:55 AM
Hi Scott,

You do not need to perform those joins manually, you can use the navigational properties in the persistent classes instead. OpenAccess will automatically create the corresponding join statements in the generated SQL. I would suggest you to try the following simplified query, which retrieves equivalent result:
var query = (from d in _DatabaseContext.DepartmentLocations
            where d.DepartmentId == 2 && d.Location.EntityId == 1
            orderby d.LocationName
            select new Container
            {
                LocationNumber = d.Location.LocationNumber,
                LocationName = d.LocationName,
                Geographies = d.Geographies,
                Customs = d.DepartmentLocationCustoms
            }).Take(100).ToList();

You can try it with and without the fetch strategy and see which query performs better in your case.
If this does not help, please let us know and we will investigate the issue further.

Kind regards,
Alexander
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
General Discussions
Asked by
Scott
Top achievements
Rank 2
Answers by
Alexander
Telerik team
Share this question
or