diff --git a/Api/Api.csproj b/Api/Api.csproj index b0e32f0..9f6fbcf 100644 --- a/Api/Api.csproj +++ b/Api/Api.csproj @@ -1,11 +1,14 @@ - net6.0 + net7.0 v4 + Exe - - + + + + diff --git a/Api/ProductsDelete.cs b/Api/ProductsDelete.cs index 1ded437..0ab6963 100644 --- a/Api/ProductsDelete.cs +++ b/Api/ProductsDelete.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Azure.WebJobs; -using Microsoft.Azure.WebJobs.Extensions.Http; +using Microsoft.Azure.Functions.Worker; using Microsoft.Extensions.Logging; using System.Threading.Tasks; @@ -16,7 +15,7 @@ public ProductsDelete(IProductData productData) this.productData = productData; } - [FunctionName("ProductsDelete")] + [Function("ProductsDelete")] public async Task Run( [HttpTrigger(AuthorizationLevel.Anonymous, "delete", Route = "products/{productId:int}")] HttpRequest req, int productId, diff --git a/Api/ProductsPost.cs b/Api/ProductsPost.cs index f35982b..e402ac3 100644 --- a/Api/ProductsPost.cs +++ b/Api/ProductsPost.cs @@ -1,12 +1,11 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Azure.WebJobs; -using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Logging; using System.IO; using System.Text.Json; using System.Threading.Tasks; using Data; +using Microsoft.Azure.Functions.Worker; namespace Api; @@ -19,7 +18,7 @@ public ProductsPost(IProductData productData) this.productData = productData; } - [FunctionName("ProductsPost")] + [Function("ProductsPost")] public async Task Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "products")] HttpRequest req, ILogger log) diff --git a/Api/ProductsPut.cs b/Api/ProductsPut.cs index a2c285a..f79176d 100644 --- a/Api/ProductsPut.cs +++ b/Api/ProductsPut.cs @@ -1,12 +1,11 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Azure.WebJobs; -using Microsoft.Azure.WebJobs.Extensions.Http; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using System.IO; using System.Text.Json; using System.Threading.Tasks; using Data; +using Microsoft.Azure.Functions.Worker; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; namespace Api; @@ -19,7 +18,7 @@ public ProductsPut(IProductData productData) this.productData = productData; } - [FunctionName("ProductsPut")] + [Function("ProductsPut")] public async Task Run( [HttpTrigger(AuthorizationLevel.Anonymous, "put", Route = "products")] HttpRequest req, ILogger log) diff --git a/Api/Program.cs b/Api/Program.cs new file mode 100644 index 0000000..2f7d78b --- /dev/null +++ b/Api/Program.cs @@ -0,0 +1,18 @@ +using Api; +using Microsoft.Azure.Functions.Worker; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var host = new HostBuilder() + .ConfigureFunctionsWorkerDefaults(workerApplication => + { + workerApplication.UseAspNetCoreIntegration(); + }) + .ConfigureAspNetCoreIntegration() + .ConfigureServices(services => + { + services.AddSingleton(); + }) + .Build(); + +host.Run(); diff --git a/Api/Startup.cs b/Api/Startup.cs deleted file mode 100644 index 6117555..0000000 --- a/Api/Startup.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.Azure.Functions.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection; - -[assembly: FunctionsStartup(typeof(Api.Startup))] - -namespace Api; - -public class Startup : FunctionsStartup -{ - public override void Configure(IFunctionsHostBuilder builder) - { - builder.Services.AddSingleton(); - } -} diff --git a/Api/local.settings.example.json b/Api/local.settings.example.json index b5dcd00..ca237cf 100644 --- a/Api/local.settings.example.json +++ b/Api/local.settings.example.json @@ -1,9 +1,10 @@ { "IsEncrypted": false, - "Values": { - "AzureWebJobsStorage": "", - "FUNCTIONS_WORKER_RUNTIME": "dotnet" - }, + "Values": { + "AzureWebJobsStorage": "", + "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated", + "AzureWebJobsFeatureFlags": "EnableHttpProxying" + }, "Host": { "LocalHttpPort": 7071, "CORS": "*", diff --git a/Client/Client.csproj b/Client/Client.csproj index 7542c27..b7d7ecc 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -1,14 +1,14 @@ - net6.0 + net7.0 disable enable - - + + diff --git a/Data/Data.csproj b/Data/Data.csproj index dbc1517..8268829 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0