Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Silverlight LINQ to Data Entity Model with stored Procedures
3 replies. Latest Post by Pravinkumar R. D. on November 6, 2009.
(0)
bpoker
Member
5 points
11 Posts
11-04-2009 1:57 PM |
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!
Pravinku...
Contributor
4300 points
708 Posts
11-05-2009 12:53 AM |
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"
11-05-2009 7:39 AM |
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?
11-06-2009 1:01 AM |
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