views:

91

answers:

2

i am using VS2008 3.5 framework.

I'm attempting to use the Entity Framework for data access, but I'm running into a few issues with stored procedures.

I imported this stored procedure into the framework diagram and then made it a function import but i dont see my stored procedure

        using (MyEntities context = new MyEntities ())
        {
            foreach (Basic visit in context.) //<<< i dont see the SP here?
            {
                                 }
        }

any help?

A: 

You need a return type. This happens often if there is no return type.

You can just create a dummy entity named ReturnHelper with one scalar value "return" as Int32 and use in in your function import as scalar output. This should do the trick :-)

Howtos: http://www.devtoolshed.com/using-stored-procedures-entity-framework-scalar-return-values

http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions

Andreas Rehm
will you show me the steps to do as i am new to EF and never done this before. - thanks.
Abu Hamzah
You can find a good explanation here:http://www.devtoolshed.com/using-stored-procedures-entity-framework-scalar-return-valuesand here:http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/
Andreas Rehm
A: 

Take a look at this discussion, for example.

Devart