在网络配置文件中,我会这样做:
<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",
}
}
}
答案 0 :(得分:1)
我实际上认为EF7中还没有这种功能。这是积压的,但似乎还没有实施。