Tow types of EF's default connection
When you create a new project that makes use of Entity Framework 5, you'll notice how it uses LocalDb by default now. But let's assume you have a fully working instance of Sql Server that you wish to work against instead of LocalDb. How do you tell EF to use it? Simple, modify your application's config file. If you are running a web service or a website, your config file is web.config. If you are running a console application or a windows application, look for app.config.
LocalDb
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
Now, replace that portion of the configuration to make use of Sql Server instead of LocalDb.
Sql Server
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=.; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
Tow types of EF's default connection的更多相关文章
- EF 数据库连接约定(Connection String Conventions in Code First)
一个典型的EF应用大多数情况下是一个DbContext的派生类(derived class)来控制,通常可以使用该派生类调用DbContext的构造函数,来控制以下的东西: (1).上下文如何连接到数 ...
- python连接redis文档001
Installation redis-py requires a running Redis server. See Redis’s quickstart for installation instr ...
- Config File Settings Of EF——实体框架的配置文件设置
我亦MSDN 原文地址 http://msdn.microsoft.com/en-us/data/jj556606 Entity Framework allows a number of settin ...
- 自定义 ASP.NET Identity Data Model with EF
One of the first issues you will likely encounter when getting started with ASP.NET Identity centers ...
- EF 约定介绍
当前环境为EF Code First开发模式中 一.EF默认约定 1.常用约定 (1).当没有显示指定实体主键的时候,EF会默认将长得最像Id的属性(且类型为GUID)设为主键 (2).设计实体时,当 ...
- EntityFramework:EF Migrations Command Reference
Entity Framework Migrations are handled from the package manager console in Visual Studio. The usage ...
- Mongoose Connection best practice
There is often quite a lot of confusion about how best to set up a database connection with Mongoose ...
- SQL Server Connection Pooling (ADO.NET)
SQL Server Connection Pooling (ADO.NET) Connecting to a database server typically consists of severa ...
- [转]Oracle connection strings
本文转自:http://www.connectionstrings.com/oracle/ Standard Data Source=MyOracleDB;Integrated Security=ye ...
随机推荐
- [Github] 本地git push免用户名和密码的配置
在终端通过git config --global命令进行配置 git config --global user.email "xxx@xxmail.com" git config ...
- HttpUrlConnection使用Get和Post访问服务器的工具类(一)
首先我们有一个返回响应的接口HttpCallBackListener public interface HttpCallbackListener { void onFinish(String resp ...
- MySQL安装部署及调优
MySQL安装 二进制安装 - mysql-5.5.49 mkdir /home/oldboy/tools -p cd /home/oldboy/tools/ rz #mysql-5.5.49-lin ...
- 【ACM非算法部分】综合篇
从零开始系列,也为了更好的补缺补漏. ===================== 目录: scanf()函数 STL汇总 读入优化 =====================
- Windows中cmd操作mysql
打开CMD 将工作目录切换到MySQL的bin下 mysql -u root -p 输入密码即可登陆MySQL 问号可以查看帮助 首先需要选择操作的数据库use database_name 然后可以进 ...
- Linux常用命令 (转载自大牛笔记 --- http://www.weixuehao.com)
Linux简介及Ubuntu安装 常见指令 系统管理命令 打包压缩相关命令 关机/重启机器 Linux管道 Linux软件包管理 vim使用 用户及用户组管理 文件权限管理 大牛笔记-www.weix ...
- onerror="javascript:this.src='images/defaultUpload.png';"【容易导致死循环报错】
当无法找到默认图片时,onerror="javascript:this.src='images/defaultUpload.png';"容易导致死循环报错
- Codeforces 1030E 【暴力构造】
LINK 题目大意:给你n个数,你可以交换一个数的任意二进制位,问你可以选出多少区间经过操作后异或和是0 思路 充分必要条件: 区间中二进制1的个数是偶数 区间中二进制位最多的一个数的二进制个数小于等 ...
- XML 的 XPath 语法
XPath 是 XML 路径语言(XML Path Language),用来确定XML文档中某部分位置的语言.无论是什么语言什么框架,几乎都可以使用 XPath 来高效查询 XML 文件. 本文将介绍 ...
- iOS中scrollview自动滚动的实现
http://bbs.csdn.net/topics/390347330 原问题是,我要展现给用户的内容放在scrollview中,让内容从上到底自动滚动,我最开始用的是DDAutoscrollvie ...