Kat
Kat

Reputation: 2500

Azure Function unable to use connection string with no Entity provider

I have an Azure Function system that's using a DAL dll. This dll uses entity framework to connect to a SQL database and is in the UnitOfWork format for our database first code.

In azure functions there isn't the standard "app.config" file to update with my connection string to my database. So I added it here in the Application Setting's GUI:

enter image description here

I have copied the code from the app.config by just taking the value from the config, converting the " values, and pasting it into the GUI.

 <add name="Entities" connectionString="<This is what I copied>" providerName="System.Data.EntityClient" />

However, whenever I run the code, I get this error:

2016-10-14T12:39:44.248 C# ServiceBus queue trigger function processed message: test
2016-10-14T12:39:44.265 Getting UnitOfWork
2016-10-14T12:39:44.607 Getting Repository
2016-10-14T12:39:44.639 ERROR The connection string 'Entities' in the application's configuration file does not contain the required providerName attribute."

So, typically the provider name would be the entity framework, but I don't know how to include that in the code. My question is, how do I connect with this connection string, and have an entity framework provider?

Upvotes: 2

Views: 988

Answers (1)

Ling Toh
Ling Toh

Reputation: 2474

If you are using Entity Framework 6 or greater, have you tried using Code-based configuration? Some sample implementation can be found here,

Upvotes: 1

Related Questions