Stored procedures in entity framework

后端 未结 3 1581
没有蜡笔的小新
没有蜡笔的小新 2021-02-09 17:31

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 -

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-09 18:18

    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:

    • A big step for Stored Procedures in EF4
    • Complex Types in the EDM Designer in EF4 and a look at updating complex types in code

    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

提交回复
热议问题