Closed uzser closed 8 years ago
I'm doing the same and debugged the problem. Setting structuralType with name (not fullname) would fix my problem also.
?? model.ConceptualModel.ComplexTypes.FirstOrDefault(structuralType => structuralType.Name.EqualsOrdinal(clrType.Name));
This is caused by Entity Framework registering entity type and complex type from different namespace/assembly with incorrect namespace. Searching just by Name
is not strong enough. The fix is:
FullName
.Name
. If there is a match, also check all property Name
s and property types.I have this error for int type returned in stored procedure:
[StoredProcedure(NameOf(uspTest), Schema = "dbo")]
public virtual ObjectResult<long?> uspTest(string i_Params)
{
var i_ParamsParameter = i_Params != null ?
new ObjectParameter("I_Params", i_Params) :
new ObjectParameter("I_Params", typeof(string));
return ObjectContext().ExecuteFunction<long?>("uspTest", i_ParamsParameter);
}
Error:
System.Nullable`1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] for method uspTest is not supported in conceptual model as a structural type.
I'm also getting this error.
Using Table Valued Function that returns int?
but obviously I cannot register that as a complex type.
@piyey Did you manage to resolve your issue with long?
?
When I'm defining entities with ComplexType attribute in other assembly and I call a table-valued function, I'm getting excepton
It's successful when entities in same assembly with function. Exception throws because model.ConceptualModel.ComplexTypes has that entity type with other full name (assembly name of type changed to assembly name of function). Maybe it needs to search by type name instead full name (Function.DbModel.cs, line 694). The same issue is in other places. Thanks.