tags:

views:

2409

answers:

3

Hi

I want to load some data with a SP.

I've put a SP in a Linq to SQL Class and I don't know how to use it for loading it's data in a datagrid. In LinqToSqlDomainService I can't figure out how to call a SP. What steps should I use.

Any samples of this ? All samples use a table.

Thank's

+2  A: 

You can create empty view with the same structure of your sproc and map that stored procedure to your function in your DomainService See sample on http://cid-289eaf995528b9fd.skydrive.live.com/self.aspx/Public/sproc.zip

slyi
A: 

Calling a stored procedure is trivial. Import it as a function and then invoke the function as a member of the DDS. The return value is an ObservableCollection<> that you can use to set up the DataContext of the object you want to bind.

...unless you want to use it in a Silverlight RIA app via the magic code generated proxy, in which case your goose is cooked unless your result rows exactly match one of the entities. If you can meet that criterion, edit the DomainService class and surface a method that wraps the ObjectContext method.

Peter Wone