Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在配置中设置ProviderService_C#_Entity Framework_Entity Framework 6_Ef Code First - Fatal编程技术网

C# 无法在配置中设置ProviderService

C# 无法在配置中设置ProviderService,c#,entity-framework,entity-framework-6,ef-code-first,C#,Entity Framework,Entity Framework 6,Ef Code First,我正在尝试将app.config ef设置移动到代码 <configuration> <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyTo

我正在尝试将app.config ef设置移动到代码

<configuration>
    <configSections>
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    </configSections>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="System.Data.SqlServerCe.4.0" />
            </parameters>
        </defaultConnectionFactory>
        <providers>
            <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
            <provider invariantName="System.Data.SqlServerCe.4.0"
                       type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
        </providers>
    </entityFramework>
    <system.data>
        <DbProviderFactories>
            <remove invariant="System.Data.SqlServerCe.4.0" />
            <add name="Microsoft SQL Server Compact Data Provider 4.0" 
                 invariant="System.Data.SqlServerCe.4.0" 
                 description=".NET Framework Data Provider for Microsoft SQL Server Compact" 
                 type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        </DbProviderFactories>
    </system.data>
</configuration>
对于最后两行,我得到以下错误:

“SqlCeProviderServices”不包含接受0个参数的构造函数”


我不知道要在这里添加什么。。。当我使用
GoToDefinition
没有构造函数时,Intellisense没有显示任何内容,类也没有显示任何内容。

通常这些服务类是作为单例实现的

例如,
SqlProviderServices
类包含以下内容:

//
// Summary:
//     The Singleton instance of the SqlProviderServices type.
public static SqlProviderServices Instance { get; }

我现在无法检查,但我非常确定
SqlProviderService
类也有类似的功能。

检查单例-类似于静态
实例
属性。就是这样!如果你想把它作为一个答案,我会接受的!非常感谢你的帮助!
//
// Summary:
//     The Singleton instance of the SqlProviderServices type.
public static SqlProviderServices Instance { get; }