Client Binding Virtual Group Paging - Handle Join Tables

3 replies. Last post: October 12, 2010 2:38 AM by Glenn Layaar
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Dave McGoffMember

I am using the ClientBinding_VirtualGroupPaging_WebService Example.  My scenario requires that I join 2 tables in order to get the necessary data for my grid. 

With a single table I have no issues.  When joining tables I am not sure of what object to use in the Provider declaration (basically how should I fill the "???" in: WebGridDataProvider<???>).

Below is my code for 1) Single table and 2) join.

 

[WebMethod]

public object GetPagedBugs(DataSourceSelectArguments selectArguments)

{

BugTrackerModelDataContext context = new BugTrackerModelDataContext();

context.DeferredLoadingEnabled = false;

// 1) Single table works great

var datasource = from b in context.Bugs

select b;

WebGridDataProvider<Bug> provider =

new WebGridDataProvider<Bug>(datasource);

// -----------------------------------------

// 2) How to join?

var datasource2 = from b in context.Bugs

join o in context.Owners on b.BugId = o.BugId

select new { b.BugId, b.Summary, o.OwnerName };

WebGridDataProvider<???> provider =

new WebGridDataProvider<???>(datasource);

// -----------------------------------------

object data = provider.Select(selectArguments);

if (data != null)

return data;

throw new InvalidOperationException("Unsupported operation type!");

}

 

 

All times are GMT -5. The time now is 9:48 PM.
Previous Next