Skip to main content

Microsoft Silverlight

Unanswered Question Silverlight LINQ to Data Entity Model with stored ProceduresRSS Feed

(0)

bpoker
bpoker

Member

Member

5 points

11 Posts

Silverlight LINQ to Data Entity Model with stored Procedures

Hello,

 I am pretty new to silverlight as well as Linq and I trying to move past the tutorial phase and actually start developing some of my own applications.  I am currently trying to just create a dynamic menu for my application.  I have build a stored procedure which returns a DataSet that will in turn drive the menu (I have already built the menu component).

 I am having trouble gfiguring out how to get the data from an SP into a collection i can work with,  I have created an ADO.NET Entity Data Model where I can access various tables and Stored Procedures in my DB.  At this point from what I gather I should be able to  right click on the SP in the Model browser and select "Create Function Import" to create a method that calls that SP.  However, I am geting a bit tripped up on the "Return Type".  I am nost sure if I need to create a class for each return type, and then dump the SP results into a collection of that class?

 

Any help, advise, pointers in the correct direction would be great!

 

Thanks!

Pravinkumar R. D.
Pravinku...

Contributor

Contributor

4300 points

708 Posts

Re: Silverlight LINQ to Data Entity Model with stored Procedures

Hi,

Check the below artical. It may help you out-

http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/12/17/ado-net-entity-framework-tools-stored-procedures.aspx

Thanks,

Pravin

"Please mark as answered, if this answers your question"

bpoker
bpoker

Member

Member

5 points

11 Posts

Re: Silverlight LINQ to Data Entity Model with stored Procedures

 Pravin,

 Thank you for replying, however I have seen similar articles, but my question is still what if the SP returns a select statement that does not map perfectly to a table.  For simplicity sake lets say there is a table called tblUsers with columns UserID int, FirstName, LastName, and BirthDate.  When I create the entity model I think I can easily create an entity called "Users".  But what if I have an SP that only returns the results of:

 SELECT FirstName, LAstName

FROM tblUsers

WHERE BirthDate > '1/1/2000'

How would I handle that?

 

Thanks!

 

Pravinkumar R. D.
Pravinku...

Contributor

Contributor

4300 points

708 Posts

Re: Silverlight LINQ to Data Entity Model with stored Procedures

Hi,

As far as the below artical - SP will return "enumeration of Entities". Checj this and let me know if this helps you or not-

http://blogs.msdn.com/efdesign/archive/2008/07/18/using-stored-procedures-to-get-load-structured-data.aspx

Thanks,

Pravin

"Please mark as answered, if this answers your question"

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities