【发布时间】:2015-04-16 01:34:54
【问题描述】:
在网络配置文件中,我会这样做:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
<interceptors>
<interceptor type="System.Data.Entity.Infrastructure.Interception.DatabaseLogger, EntityFramework">
<parameters>
<parameter value="C:\tmp\DataAccessLogOutput.txt" />
</parameters>
</interceptor>
</interceptors>
</entityFramework>
但是如何在 vnext 的 config.json 中做到这一点:
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=(localdb)\\mssqllocaldb;Database=aspnet5-Cupcake-a652ca1c-0d92-4155-ad46-bfb68bb538ee;Trusted_Connection=True;MultipleActiveResultSets=true"
}
},
"EntityFramework": {
"ApplicationDbContext": {
"ConnectionStringKey": "Data:DefaultConnection:ConnectionString",
}
}
}
【问题讨论】:
-
很遗憾,大多数 vnext 内容的文档记录都很差。我一直在寻找这样的问题,完全没有答案,而且在网络上的任何地方都没有任何文档。这是一个失望。因为我真的认为这个 json 的东西可以比 web.config 更好,但是没有文档它是完全没用的。
-
@RobertNoack 这就是测试版软件的诅咒。
-
@Josh:能找到答案吗?
标签: asp.net-core entity-framework-core