1. Install ef4.1 and add reference 2. Add reference system. Data. Entity
The addition, deletion, and modification of the original EF of the http://wenku.baidu.com/view/97046e32ee06eff9aef807c2.html are good.
Http://blog.163.com/xu_shuhao/blog/static/5257748720101028102055825?
Http://blog.163.com/haohengzhen@126/blog/static/7613791020113114352388/fromdm&fromSearch&isF
Romsearchengine = Yes Stored Procedure outputs parameters in the original ef
Http://hi.baidu.com/wufengtinghai/item/433cea2cdaca5c9db632633c
Complex stored procedures are troublesome in the original ef
There is an executefunction method in objectcontext in the middle layer to call the stored procedure.
Http://www.cnblogs.com/wlflovenet/archive/2011/12/30/EF11.html is good for new ed stored procedures
Use dbset <entity>. sqlquery ()
Stored Procedure:
Create proc t_get
@ ID varchar (10)
Begin
Select * from course where id = @ ID
End
Public Virtual ienumerable <tentity> getwithrawsql (string query, Params object [] parameters)
{
Return dbset. sqlquery (query, parameters). tolist ();
}
Public actionresult details (int id)
{
VaR query = "Exec t_get @ P0 ";
Return view (unitofwork. courserepository. getwithrawsql (query, ID). Single ());
}
Note that the parameter names must be @ P0 and @ P1 are arranged in sequence.