Using a console app that connected to a DB using EF, I was able to call Update-Database
and have it connect to the DB. However, I'm having trouble when trying to migrate this over to an Azure function. A similar question was asked here, and I suspect the solution might be the same, although there's not too much detail on what that might be.
In my console app, the following relevant configuration was supplied:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<connectionStrings>
<add name="DBConnection" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Database=MyDB;User Id= . . ." />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
In my local.settings.json, I have only the DB Connection String:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=...",
"AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=...",
},
"ConnectionStrings": {
"DBConnection": "Server=.\\SQLEXPRESS;Database=..."
}
}
The implication in the linked question, is that the provider name needs to be supplied. I would assume that some of the other EF config sections would also need to be supplied. As it is, when I run Update-Database
with the Functions app set as start-up, I get this error:
Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly
Which tends to just mean that the start-up project doesn't have the correct EF configuration.
My question, therefore, is what additional configuration do I need in my local.settings.json file?