sql server - WCF Service - return the output parameter from a stored procedure in Entity Model -
i have stored procedure authentication, taking login , password , returning string . call stored procedure(sql server 2005) wcf data service ( using entity model , function imports ) , return output parameter( string ) result .
i using function import map stored procedure. how should proceed ?
finally, got answer !! have use output parameter , give argument called stored procedure , type cast can use value . ( return format json equally valid xml format) interface : [operationcontract] [webinvoke(method = "get", bodystyle = webmessagebodystyle.wrapped, responseformat = webmessageformat.json, requestformat = webmessageformat.json, uritemplate = "authenticate/{login}/{pwd}")]
implementation: public string authenticate(string login, string pwd) { steelcasemigrationentities entities = new steelcasemigrationentities(); system.data.objects.objectparameter output = new system.data.objects.objectparameter("out", typeof(string)); entities.authenticate_android(login, pwd, output); //console.write(output.value) string result = (string)output.value; return result; }
Comments
Post a Comment