I'm working with Entity Framework but have a hierarchical datasource. It takes too long time to make db-queries and convert to json in the controller.
For that reason, I have a stored procedure.
Executing the stored procedure directly in the Microsoft SQL Server Management Studio, I get the expected output.
But trying to do the following in my Controller throws the following exception.
`IEnumerable<MyItem> itemsJson=Context.Database.SqlQuery<MyItem>("Get_JSON_MyItems").ToList();`
System.Data.Entity.Core.EntityCommandExecutionException: 'The data reader is incompatible with the specified 'MyDataModel.MyItem'. A member of the type, 'Id', does not have a corresponding column in the data reader with the same name.'
I guess the data reader splits the string into many fields because it is too long? But I'm not sure and don't know how I'd fix if so.
--
(Also tried to write the command in the Controller instead executing the stored procedure)