开发者

EntityCommandExecutionException from Entity Framework

开发者 https://www.devze.com 2023-03-25 14:21 出处:网络
I\'m confused on why I am getting an exception when I call a stored procedure from the entity framework api.The error states:

I'm confused on why I am getting an exception when I call a stored procedure from the entity framework api. The error states:

    The data reader is incompatible with the specified [Model].[SP_Result_Type]. 
A member of the type, [typeName], does not have a corresponding column in the data reader with the same name.

The SP in 开发者_StackOverflow社区question is a SELECT command that gets values from (3) different tables and Entity Framework returns the values in a ComplexObject type. By "data reader", I guess the exception is referring to a type created by the EF API. If so, both the "data reader" and the table(s) have the correct variable names, so I don't understand the cause of this exception.

The change would probably be in the designer EF created, but I don't know what to change.


the error is clearly not in the entity/variable names but in the fields, there is a missing column, you should probably update the complex object type definition to either add the missing column or remove the old one no longer present in the db or not returned anymore by the stored procedure you are calling.

hope this helps :)


If I'm not mistaken if you are using SQL Compact, then EF does not support Stored Procedures with Sql Compact.

"SQL Server Compact does not support stored procedures and views."

Link found here

0

精彩评论

暂无评论...
验证码 换一张
取 消