Can I make a WebAPI that uses EF6, in Azure?

Rod Falanga 561 Reputation points

At work we write new apps using .NET 4.5.2 and EF6. I'm wondering if I can write WebAPIs that will run in an Azure App Service with .NET 4.5.2 and EF6? Or are Web APIs in Azure App Services only for CORE 3.x and 5?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,719 questions
Microsoft Technologies based on the .NET software framework.
3,321 questions
0 comments No comments
{count} votes

Accepted answer
  1. Duane Arnold 3,211 Reputation points

    @Rod Falanga

    1) EF Core 5 works with .NET Framework 5.0 that is a Core .NET Framework. .NET 5 is Core.

    2) You can use ASP.NET WebAPI 2 using .NET 4.5.2 that will work with EF 6.

    3) This time, you can use a classlib project to hold the DTO(s) that is using .NET 4.5.2, and you should leave the DTO(s) at the WebAPI as discussed in the EF Core forum.

    You should try to implement seperation of concerns with the WebAPI referencing the DAL using the DTO and DAO patterns for CRUD operations with EF.

    Here is a solution out on Github that is using a .NET 4.x framework, WebAPI 2, EF 6 database first and DTO and DAO patterns, but it is was done in VB.NET.

    As couple of other things about logging in WebAPI, which is being shown in the which is also be shown in the code example in the EF Core forum concerning the shown project code.

    DI is being used in both solutions being shown in the two forums.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Ken Kam Hung, Lin 91 Reputation points

    Azure App Service is just like an IIS WebSite but in Azure.
    You could do local development with .NET 4.5.2 and EF 6, Target as WebAPI in local IIS first. Then you could create Azure App Service and ftp your compiled files to it. Or saving your source code to GitRepo/Github and then using Azure DevOps to do the Azure pipeline to deploy it.

    Some links here are useful for you to read.

    Create WebAPI with EF6

    Deploy to Azure App Service
    from there you can also found the other options, via ftp, via cloud sync, CI/CD, Azure DevOps, from Local Git....etc

    1 person found this answer helpful.
    0 comments No comments