Akarapol P
Akarapol P

Reputation: 11

Azure function use Entity Framework 6.0.0 problem

I have a problem accessing data in SQL server through Entity Framework on Azure function. Context:

  1. This is an Azure function project (.NET Core 3.1)
  2. I created .NET Framework Class Library (.NET Framework 4.6.1) in the same solution to access (Database First) SQL server via Entity Framework. enter image description here
  3. I created StartUp.cs in Azure function project. enter image description here
  4. I inserted ConnectionString to my local.setting.json in Azure function project. enter image description here
  5. I try to call ModelEntities in Azure function but it does not work. enter image description here This is the message when it has trigger from Event-hub. enter image description here

Please suggest to me, if you have an experience about this.

Thank you for your time.

Upvotes: 1

Views: 444

Answers (2)

Shilpa
Shilpa

Reputation: 164

I know this is a old question but answering it for people still trying to use existing EF6 code in Azure Functions Apps

Try using latest Azure Function which is supported in .Net 6.

Upvotes: 0

David Browne - Microsoft
David Browne - Microsoft

Reputation: 88852

This is an Azure function project (.NET Core 3.1)

Then just add EF to your main function project through NuGet. You can't mix .NET Framework libraries and .NET Core apps. And creating libraries to use in a Azure Functions project is probably overkill, and definitely adds complexity.

Upvotes: 2

Related Questions