Entity Framework does not work with stored procedures!

Is it true that you cannot invoke sp with EF if sp does not return an object?

To check, I created 3 Import functions for sp with 1. The return type is not returned 2. The return type

then when I type "DataContext" then "." I get intellisense only from a function that returns an object!

I am surprised that this is not the current function!

What do people use as a workaround?

+7
c # entity-framework
source share
4 answers

Workaround!

Julia Lerman wrote a post about this. Take a look at her blog: http://thedatafarm.com/blog/data-access/implement-select-stored-procedures-that-return-miscellaneous-data-in-ctp2-of-ef-designer/

This helped me implement my stored procedures.

+2
source share

You need to return the object, yes.

0
source share

Using Powerful T4 Templates

Entity Framework V1.0 feels and is an incomplete product published too soon. That is why you can use T4 templates that create different codes from EDMX files, which also support scalar-type stored procedures.

We use customizable templates with many modifications, so they create business-level objects, interfaces for IoC / TDD, as well as DAL and DAO. We get all of the EDMX files. Heck we even create enumerations, but they are created from real data in DB files, not EDMX.

You can find many T4 templates ... Here is one that does scalar stored procedures . But you might want to get the one that POCO actually does.

0
source share

In EF v1, you can only display procedures that return entities. In EF v4, you can match the results of a procedure with complex types, so most procedures can be used without returning objects.

Use Chrigl answer (+1) as a workaround for v1.

0
source share

All Articles