Dixin / EntityFramework.Functions

EntityFramework.Functions library implements Entity Framework code first support for stored procedures (with single result type, multiple result types, output parameter), table-valued functions (returning entity type, complex type), scalar-valued functions (composable, non-composable), aggregate functions, built-in functions, niladic functions, and model defined functions.
https://weblogs.asp.net/Dixin/EntityFramework.Functions
MIT License
79 stars 27 forks source link

Stored Procedures that return non-complex types #25

Open frankszymanski opened 7 years ago

frankszymanski commented 7 years ago

The database that I'm working to convert from model-first to code-first has stored procedures that return unnamed columns of basic types. The model-first function that is generated has a return type of ObjectResult<Nullable<long>> or ObjectResult<string>.

Is this possible with your library?

frankszymanski commented 7 years ago

The underlying issue seems to be in Function.DbModel.GetModelReturnParameters(). The Stored Procedure case tries to get the model types for the returns, but GetModelStructualType() only considers Entity and Complex types.

If I create a new GetModelType function that returns an EdmType instead of a StructuredType and calls model.GetModelPrimitiveType in addition to model.GetModelEntityType and model.GetModelComplexType, I can map to primitive types.