c# - Entity Framework compilation error in return methods -
i imported database visual studio project. here code main.cs file:
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace entityframework { class program { static void main(string[] args) { northwindentities db = new northwindentities(); foreach (var customer in db.customers) { console.writeline(customer.contactname); } db.dispose(); } } }
the problem error:
error cs1502: best overloaded method match 'system.data.entity.core.objects.objectcontext.executefunction(string, params system.data.entity.core.objects.objectparameter[])' has invalid arguments
when double click on automatically go method:
public virtual objectresult<custorderhist_result> custorderhist(string customerid) { var customeridparameter = customerid != null ? new objectparameter("customerid", customerid) : new objectparameter("customerid", typeof(string)); //the error shows problem in return return ((iobjectcontextadapter)this).objectcontext.executefunction<custorderhist_result>("custorderhist", customeridparameter); }
it shows problem in return of method. error occurs everywhere return written. haven't written these functions. entity framework has created them automatically. have suggestions problem might be?
some ways investigate :
- are sure customerid in db in string format ? it
not incremental int ? - are using sql server or db ?
the autogenerated file.designer.cs ever simple stored procedure retrieve not complex object, think sp not correctly imported in edmx. check if sp method correct type i/o, check if using db sql server configure oledb.
Comments
Post a Comment