Entity Framework 4.1 learning notes

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.