C# 无法在配置中设置ProviderService
我正在尝试将app.config ef设置移动到代码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
<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; }