how to design repository design pattern code as a result it can call store proc too. share idea or any write up to design the code. thanks
public IEnumerable<T> ExecWithStoreProcedure(string query, params object[] parameters) { return _context.Database.SqlQuery<T>(query, parameters); } IEnumerable<Products> products = _unitOfWork.ProductRepository.ExecWithStoreProcedure( "spGetProducts @bigCategoryId", new SqlParameter("bigCategoryId", SqlDbType.BigInt) { Value = categoryId } );
Take a look at these.
http://stackoverflow.com/questions/18201646/repository-pattern-to-execute-a-stored-procedure-using-entity-framework
http://code-clarity.blogspot.se/2012/02/entity-framework-code-first-easy-way-to.html
http://stackoverflow.com/questions/4873607/how-to-use-dbcontext-database-sqlquerytelementsql-params-with-stored-proced