Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am connected to my db via LINQ to SQL dbml objects. When I search for customers I need to get several linked tables too.
These include things like Payment Details, contact history, claim history etc...

I use paging so my data sets won't ever be very big. I would like to get all the data in one hit, but If I can't do it then I'll just have to get the results individually. This isn't a huge issue but it does make my save and edit features much more complex.

I need the result to be IQueryable as this is how my paging, filtering and sorting works. If I use a Stored Proc. then I would have to reverse engineer those to be used as parameters, and that way much messiness lies :S

Am I even making sense at this point? Maybe too much coffee for a friday :S

Thanks ^_^
Andy



PS: Some obligatory code
JavaScript
// details is my object that contains all of the editable data.  It is passed to each control so they can fill in their controls.
var data = details.PaymentDetails;
//The linked table objects have Data and Total used for paging.  Page size and index is dictated by the grid

var pageSize = 5,
    sort = user.settings.PaymentDetails.Sort, // default []
    group = user.settings.PaymentDetails.Group,// default []
    filter = user.settings.PaymentDetails.Filter,// default []
    columns = user.settings.PaymentDetails.Columns// default PaymentType, Status
//This is for those familiar with Kendo controls
var dataSource = new kendo.data.DataSource({
    data: data,
    schema: {
                total: "Total",
                data: "Data",
                model: {
                    id: "Id"
             },
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true,
    pageSize: pageSize,
    sort: sort,
    filter: filter,
    group: group
});


Some exposition, as if you really care :P
The idea is that the main control (CustomerManagement) that contains these tabs child controls (CustomerDetails., PaymentDetails. etc) will check the changes against the original values. The last tab control is SaveChanges which summarizes the changes letting the user know which changes require Admin authorization etc, and what actions are available after the new details are in the system.
Oh, this section is for our Agents (telephone operators) to use. It has to be fast (signalr), dynamic (interlinked with every other agent currently logged in, again: signalr), and be fraud resistant; hence why i won't let users change payment details without authorization.
Posted
Comments
Andy Lanng 21-Aug-15 11:48am    
Ooh - that could be spot on. I can still add my paging function for the subset of included results, right? i.e. Take(pageSize) etc?
Richard Deeming 21-Aug-15 11:51am    
Yes, the Include method returns an IQueryable instance with the original type parameter intact, so you can still call other query methods on it.
Andy Lanng 21-Aug-15 11:54am    
Nice - thanks
Maciej Los 12-Oct-15 13:44pm    
Have you solved it?

1 solution

This answered this question:

Quote: Richard Deeming at 21-Aug-15 11:20am


Are you looking for the Include method[^]?
Entity Framework : Loading Related Entities[^]
Loading Related Entities with Entity Framework - A Beginner's Primer[^]
 
Share this answer
 
Comments
Maciej Los 13-Oct-15 5:51am    
Have a 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900