Skip to content

Upgrade to latest Azure Functions SDK #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/BasicSample/BasicSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.4.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WebJobs.Extensions.HttpApi\WebJobs.Extensions.HttpApi.csproj" />
Expand Down
4 changes: 1 addition & 3 deletions samples/IsolatedSample/Function1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ namespace IsolatedSample;
public class Function1(IHttpContextAccessor httpContextAccessor, ILogger<Function1> logger)
: HttpFunctionBase(httpContextAccessor)
{
private readonly ILogger _logger = logger;

[Function("Function1")]
public IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req)
{
_logger.LogInformation("C# HTTP trigger function processed a request.");
logger.LogInformation("C# HTTP trigger function processed a request.");

return Ok($"Welcome to Azure Functions, {req.Query["name"]}!");
}
Expand Down
4 changes: 2 additions & 2 deletions samples/IsolatedSample/IsolatedSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Functions.Worker.Extensions.HttpApi\Functions.Worker.Extensions.HttpApi.csproj" />
Expand Down
18 changes: 11 additions & 7 deletions samples/IsolatedSample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using Azure.Functions.Worker.Extensions.HttpApi.Config;

using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.Extensions.Hosting;

var host = new HostBuilder()
.ConfigureFunctionsWebApplication(workerApplication =>
{
workerApplication.AddHttpApi();
})
.Build();
var builder = FunctionsApplication.CreateBuilder(args);

host.Run();
builder.ConfigureFunctionsWebApplication()
.AddHttpApi();

// Application Insights isn't enabled by default. See https://aka.ms/AAt8mw4.
// builder.Services
// .AddApplicationInsightsTelemetryWorkerService()
// .ConfigureFunctionsApplicationInsights();

builder.Build().Run();
2 changes: 1 addition & 1 deletion samples/ProxySample/ProxySample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.4.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WebJobs.Extensions.HttpApi\WebJobs.Extensions.HttpApi.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion samples/VirtualPathSample/VirtualPathSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.4.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WebJobs.Extensions.HttpApi\WebJobs.Extensions.HttpApi.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion samples/WebsiteSample/WebsiteSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.4.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WebJobs.Extensions.HttpApi\WebJobs.Extensions.HttpApi.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ public static class HttpApiBuilderExtensions
{
public static IFunctionsWorkerApplicationBuilder AddHttpApi(this IFunctionsWorkerApplicationBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
ArgumentNullException.ThrowIfNull(builder);

builder.Services.AddHttpContextAccessor();
builder.UseMiddleware<HttpContextAccessorMiddleware>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Functions.Worker.Extensions.HttpApi/HttpFunctionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Azure.Functions.Worker.Extensions.HttpApi;

public class HttpFunctionBase(IHttpContextAccessor httpContextAccessor) : WebJobs.Extensions.HttpApi.Core.HttpFunctionImpl(httpContextAccessor)
{
}
public class HttpFunctionBase(IHttpContextAccessor httpContextAccessor) : WebJobs.Extensions.HttpApi.Core.HttpFunctionImpl(httpContextAccessor);
4 changes: 1 addition & 3 deletions src/WebJobs.Extensions.HttpApi/HttpFunctionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Azure.WebJobs.Extensions.HttpApi;

public class HttpFunctionBase(IHttpContextAccessor httpContextAccessor) : Core.HttpFunctionImpl(httpContextAccessor)
{
}
public class HttpFunctionBase(IHttpContextAccessor httpContextAccessor) : Core.HttpFunctionImpl(httpContextAccessor);