为什么在DbConfiguration类中使用SetDefaultConnectionFactory [英] Why SetDefaultConnectionFactory is used in DbConfiguration class

查看:57
本文介绍了为什么在DbConfiguration类中使用SetDefaultConnectionFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从此网站中学习DBConfiguration类.>

I am learning the DBConfiguration class from this site.

public class MyConfiguration : DbConfiguration
{
    public MyConfiguration()
    {
        SetDefaultConnectionFactory(new LocalDbConnectionFactory("v11.0"));
        AddProvider("My.New.Provider", new MyProviderServices());
    }
}

为什么在这里使用 SetDefaultConnectionFactory ?为什么将其称为 Default ?

Why SetDefaultConnectionFactory is used here? Why it is mentioned as Default?

推荐答案

用于初始化与前端的提供程序连接.请参考 http://msdn.microsoft.com/zh-cn/library/system.data.entity.database.defaultconnectionfactory(v=vs.103).aspx 有关数据库相关问题的更多详细信息

Used for initializing the provider connection with the front end. Please refer http://msdn.microsoft.com/en-us/library/system.data.entity.database.defaultconnectionfactory(v=vs.103).aspx for more details about database related issues

这篇关于为什么在DbConfiguration类中使用SetDefaultConnectionFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆