Entity Framework 4 - Issues with ExecuteFunction <T> Functions Import Associated with POCO Complex Type

I get an error when I try to execute FunctionImport- the result is mapped to POCO ComplexType - from the user ObjectContext. In particular, the error indicates:

The type parameter BlahComplexTypein ExecuteFunction is incompatible with the type BlahComplexTypereturned by the function.

Since I use custom ObjectContext(I work with the full POCO Entity Framework), I have to call FunctionImportmanually, which I like:

var blah = ExecuteFunction<BlahComplexType>("GetBlah", MergeOption.NoTracking,
            new ObjectParameter("p_one", paramOne),
            new ObjectParameter("p_two", paramTwo),
            new ObjectParameter("p_three", string.Empty));

I do not use any T4 templates to create POCOs, all classes are written manually. BlahComplexType- a class with simple data type properties. Its definition matches the ComplexType definition in the .edmx file, including matching namespaces and everything (I have many other objects and complex types mapped to POCOs).

The msdn documentation says here that the return type ExecuteFunction<T>should implement IEntityWithChangeTracker, but this is not the whole point of comparison to ComplexType, not Entity, precisely because I am not interested in any changes (in fact, changes are not allowed - BlahComplexType is considered an "Object of value ")?

Has anyone managed to call FunctionImport with ExecuteFunction, whose results are compared with POCO ComplexType with Entity Framework 4?

+3
1

, !

POCO - ComplexType EDMX POCO. , . , , , "", .

( "AcctId", "Acctid" ) ( int (Int32), Int16).

, , EDMX POCO. ( , !)

Facepalm

+5

Source: https://habr.com/ru/post/1782465/


All Articles