Why do we have to write SET FMTONLY OFF in stored procedures when using Entity Framework

后端 未结 4 1026
时光说笑
时光说笑 2021-02-04 10:51

I recently joined one of the project in my team. They use ASP.NET MVC and MS SQL along with Entity Framework as ORM.

I noticed that each of the stored procedures used in

4条回答
  •  自闭症患者
    2021-02-04 11:20

    As far as I understand the scenarios, when an EDMX is updated, to return the result set instead of INT for a stored procedure, SET FMTONLY OFF is helpful.

    For ex. "SELECT * FROM @tempTable" is written in a stored procedure,when an edmx is updated for this stored procedure, the type generated in Context.cs file for this stored procedure can be - public virtual int SPName.

    Ideally it must be: public virtual ObjectResult SPName

    To attain the above result, we have to use SET FMTONLY OFF.

    We are avoiding the return type as INT and making it as type of resultset: LINK to know how to use: http://www.sandeepknarware.in/?p=247

提交回复
热议问题