R – Stored procedures in entity framework

entity-frameworkstored-procedures

I am trying to use a stored procedure in the entity framework that returns nothing. The stored procedure is purely for logging.

I added a function (right click -> add -> function import) which works ONLY when the return value is set to one of the entities. When I change the return type to be Int32, Bool or nothing, or any other value than an entity, the function (method) simply vanishes as soon as I hit the build button.

Any suggestions on how I can get this sorted?

Best Answer

For now you cannot - you have to use one of the entities defined in your model (although I thought basic scalar types like INT should work, too).

Things should get a lot better with EF4 - due out in late 2009 or early 2010.

See these articles for some info on those new features:

If your stored proc is purely for logging, I would probably just surface it outside the Entity Framework context and just call the stored procedure the good old-fashioned ADO.NET way.... why even bother putting all of that into an EF context? You're not retrieving, manipulating and storing data with this logging service - just make it a static method on a static class - keep it simple!

Marc