Custom Stored Procedure Question

Jun 13, 2012 at 11:57 PM

Is there a way to map the result set of a call to a custom stored procedure to an existing model? For example if I have a Foo table and as a result, NHydrate creates a respective Foo model object. However, when I create a custom stored procedure called for instance 'Foo_GetAllFoos' and import it, I don't have a way to map the results to a list of Foo objects already created by NHydrate. Instead, it creates a redundant 'Foo_GetAllFoos' model object and uses that for the result set.

Please advise.

Jul 9, 2012 at 2:56 AM

There is no way to map a stored proc to a entity collection. Since you can use LINQ to write complicated design-time, compile-time checked queries this is not as useful. However I do realize that there are somethings that you can only do with stored procs. In this case you will have to use the entity stored proc collection. I know it might be a copy of another Entity object, but there is no work around. You will have to use the Foo_XXX stored proc entity collection in code.