开发者

Entity framework - Add scalar to complex type

I have extended the Entity framework to implement an 开发者_StackOverflow社区interface by adding to the partial classes. I need to add a Scalar property to an Entity_Result complex type. The type was generated from a stored procedure. The scalar is necessary to support the input parameters of the stored proc.

Adding a new complex type will not suffice as this breaks the interface and IoC. I added a scalar - string property to Entity_Result and got error:

The data reader is incompatible with the specified 'Entity_Result'. A member of the type, 'EndWeekOfYear', does not have a corresponding column in the data reader with the same name.

How can I fix this? I would rather not add an Object param to my interface, but it's the only thing I can think of.


I tried adding an automatic property get set on a partial class of a regular entity and it works fine. Can you post some code of the added attribute ?
Edit: thanks for you kind reply.
Back to the issue, I think I know why the difference; when adding to the model browser you are adding a property to the CSDL and it gets decorated with the EdmMemberAttribute - I think that causes it to require a mapping from the SSDL.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜