When executing a command, parameters must be exclusively database parameters or values.
I was trying to call the stored procedure generated from POCO. I have cross checked many times but all the parameters in the SP and code are same. I am spending many time on this. The generated method is returning only int (public int CspGetHomePage(string chrCode, int? intRestId, System.DateTime? sdtmWeek, string chrCriteria)) but I want it in a return model. Hence I customized to return it as modal method (public System.Collections.Generic.List
Does your customised code work? Can you show me the stored procedure?
Yes my customized code builds successfully. I can able to call the CspGetHomePage method and it execute successfully. But when I call the customized code its throwing me error. For your reference i have attached the Stored Procedure. @sjh37
I hope this issue is already marked. https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/issues/316 #316 @sjh37 am I issue is related to that?
Yes, it could be related to #316.
If you run the following in SSMS, with suitable parameters, do you get your results ok without an error?
DECLARE @chrCorpCode CHAR(4) = 'aaaa';
DECLARE @intRestaurantID INTEGER = 1;
DECLARE @sdtmRestaurantWeek SMALLDATETIME = GETDATE() - 1;
DECLARE @chrBusinessCriteria CHAR(3) = 'bbb';
exec [dbo].[csp_GET_ForecastForHomePage] @chrCorpCode, @intRestaurantID, @sdtmRestaurantWeek, @chrBusinessCriteria;
Yes I can see my results. @sjh37 Now is it possible to get the result from the code?
No not yet. I'll have to test with another variation of your stored procedure as I don't have your tables. For now, keep using your customised code.
Actually customized POCO generated code is throwing me the Error. (When executing a command, parameters must be exclusively database parameters or values.) So now i was trying to make LINQ statement. Kindly let me know if any other approaches comes.
That EF error comes from mixing SqlParameter objects with raw values. The underlying problem, a return model the database cannot describe, is handled in v4 by defining the model yourself in Settings.ReadStoredProcReturnObjectCompleted; see Stored Procedure Return Model Errors. Closing.