Visual2013 Configure EntityFramework to connect to the SQL Server database

Source: Internet
Author: User

To configure how EF links SQL Server

Materials:

1, Entity Framework version: 6.0 + (EntityFramework.dll, EntityFramework.SqlServer.dll) (You can use nugget to get the latest version of EntityFramework)


2, VS2013 (FrameWork4.5)


Steps:

1. Create a project and then introduce the 2 DLLs of the Entity framework.

2, tool-> extension and update-> network search to "Entity FrameWork power Tools Beta4", add this extension to VS2013, restart vs.

3. Use code A to generate the EF codes used in the project.

4, after the creation of the config file modified.

Red Box One

<configSections>

<section name= "EntityFramework" type= " System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, entityframework "requirepermission= false"/>

</configSections>

Red Box Two

<entityFramework>

<defaultconnectionfactory type= " System.Data.Entity.Infrastructure.SqlConnectionFactory, entityframework ">

<parameters>

< Parameter value= "v11.0"/>

</parameters>

</defaultConnectionFactory>

</entityfram Ework>

5, Note: If the error, please check whether the introduction of the EF DLL; Is there a special character in the database field

6, configuration complete, write code test.

Related Article

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.