public IList<Product> GetProductsByCategoryId(int categoryId)
{
IList<Product> products;
using (var context = new NorthwindData())
{
SqlParameter categoryParam = new SqlParameter("@categoryID", categoryId);
products = context.Database.SqlQuery<Product>("Products_GetByCategoryID @categoryID", categoryParam).ToList();
}
return products;
}
public Product GetProductById(int productId)
{
Product product = null;
using (var context = new NorthwindData())
{
SqlParameter idParameter = new SqlParameter("@productId", productId);
product = context.Database.SqlQuery<Product>("Product_GetByID @productId", idParameter).FirstOrDefault();
}
return product;
}
http://www.codeproject.com/Articles/121340/Exposing-a-Stored-Procedure-in-WCF-Data-Service
http://www.lucbos.net/2012/03/calling-stored-procedure-with-entity.html
'ms-sql' 카테고리의 다른 글
left outer join - oracle type (0) | 2019.09.06 |
---|---|
Example Cursor (0) | 2011.04.27 |
SQL SERVER – UDF – Get the Day of the Week Function (0) | 2011.04.26 |
컴퓨토피아 :: MSSQL 에서 XML 데이터 입력, 출력, 수정하는 방법 (0) | 2010.08.14 |
xml 관련 (0) | 2010.07.28 |