Entity Framework using Stored Procedure - needs help
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 diagra开发者_开发问答m 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?
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
Take a look at this discussion, for example.
精彩评论