public async Task <Models.Northwind.GetProductDetailResult> GetProductDetails(int?ProductId) { OnGetProductDetailsDefaultParams(ref ProductId); SqlParameter[] @params = { new SqlParameter("@returnVal", SqlDbType.Int) { Direction = ParameterDirection.Output }, new SqlParameter("@ProductId", SqlDbType.Int) { Direction = ParameterDirection.Input,Value = ProductId }, new SqlParameter("@ProductName", SqlDbType.VarChar, 100) { Direction = ParameterDirection.Output }, new SqlParameter("@UnitPrice", SqlDbType.Decimal) { Direction = ParameterDirection.Output }, new SqlParameter("@QuantityPerUnit", SqlDbType.VarChar, 20) { Direction = ParameterDirection.Output }, }; context.Database.ExecuteSqlRaw("EXEC @returnVal=[dbo].[GetProductDetails] @ProductId, @ProductName out, @UnitPrice out, @QuantityPerUnit out", @params); var result = new Models.Northwind.GetProductDetailResult(); result.returnValue = Convert.ToInt32(@params[0].Value); result.ProductName = Convert.ToString(@params[2].Value); result.UnitPrice = Convert.ToDecimal(@params[3].Value); result.QuantityPerUnit = Convert.ToString(@params[4].Value); OnGetProductDetailsInvoke(ref result); return(await Task.FromResult(result)); }
partial void OnGetProductDetailsInvoke(ref Models.Northwind.GetProductDetailResult result);