I have an assembly data project in my solution that is being consumed by a different project. The data project contains three different edmx entries.

I'm calling a function import in one, but inside the edmx.cs I'm receiving an error on the calling line:

return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction

((IObjectContextAdapter)this).ObjectContext

is returning the type of a different context entirely! Thus it cannot find the function I'm calling.

Has anyone seen this behavior before? I don't know why it would be in one context and yet return the other type when the ObjextContext is checked.

有帮助吗?

解决方案

A foolish mistake on my part. My connection string in the consuming project was pointing to the wrong csdl. The code compiles fine, you can update from the model perfectly, but it will break at runtime when the consuming project's config is used. Even though you can trace into the edmx.cs file for your data project, it will cast to the other model on the execution line.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top