From caddf78704c91fb1bafcd98037380b8631d0c83e Mon Sep 17 00:00:00 2001 From: pmosk Date: Tue, 30 Jan 2024 19:22:29 +0400 Subject: [PATCH] Use C# 12 --- .github/workflows/dotnet.yml | 44 --------------- src/Infra.Azure.sln | 32 ----------- .../Azure.DurableTask.Generator.csproj | 4 +- .../DurableHandlerFunctionSourceGenerator.cs | 6 +-- .../ActivityFunctionDataProvider.cs | 18 +++---- .../EntityFunctionDataProvider.cs | 12 ++--- .../OrchestrationFunctionDataProvider.cs | 18 +++---- .../Annotation/ActivityFunctionAttribute.cs | 5 +- .../Annotation/EntityFunctionAttribute.cs | 6 +-- .../OrchestrationFunctionAttribute.cs | 5 +- .../Api.Activity/OrchestrationActivityApi.cs | 2 +- .../Azure.DurableTask.csproj | 7 +-- .../Azure.Endpoint.Generator.csproj | 4 +- .../Metadata/EndpointResolverMetadata.cs | 3 +- .../Metadata/FunctionProviderMetadata.cs | 3 +- .../Extensions.GetProviderTypes.cs | 2 +- .../Annotations/EndpointFunctionAttribute.cs | 8 +-- .../EndpointFunctionSecurityAttribute.cs | 8 +-- .../Azure.Endpoint/Azure.Endpoint.csproj | 8 +-- .../Builder.AddFunction.cs | 2 +- .../Azure.Handler.Generator.csproj | 4 +- .../Function/EventGridFunctionDataProvider.cs | 18 +++---- .../Function/HttpFunctionDataProvider.cs | 24 ++++----- .../ServiceBusFunctionDataProvider.cs | 18 +++---- .../HandlerFunctionProvider.cs | 3 +- .../HandlerFunctionSourceGenerator.cs | 8 +-- .../Metadata/FunctionArgumentMetadata.cs | 5 +- .../Metadata/FunctionAttributeMetadata.cs | 9 ++-- .../Metadata/FunctionProviderMetadata.cs | 3 +- .../Metadata/HandlerFunctionMetadata.cs | 5 +- .../Function/HttpFunctionAttribute.cs | 8 +-- .../Annotations/HandlerFunctionAttribute.cs | 8 +-- .../Azure.Handler/Azure.Handler.csproj | 5 +- .../Azure.HealthCheck.Generator.csproj | 30 ----------- .../Builder.BuildFunction.cs | 52 ------------------ .../HealthCheckFunctionBuilder.cs | 5 -- .../HealthCheckFunctionSourceGenerator.cs | 21 -------- .../Metadata/HealthCheckMetadata.cs | 23 -------- .../Extensions.GetProviderTypes.cs | 53 ------------------- .../SourceGeneratorExtensions.cs | 21 -------- .../SymbolVisitor/ExportedTypesCollector.cs | 48 ----------------- .../Azure.HealthCheck.csproj | 26 --------- .../HealthCheckFuncAttribute.cs | 20 ------- .../Azure.HealthCheck/HealthCheckFunction.cs | 19 ------- .../Azure.Hosting/Azure.Hosting.csproj | 7 +-- .../Azure.KeepWarm.Generator.csproj | 30 ----------- .../Builder.BuildFunction.cs | 28 ---------- .../KeepWarmFunctionBuilder.cs | 5 -- .../KeepWarmFunctionSourceGenerator.cs | 21 -------- .../Metadata/KeepWarmMetadata.cs | 20 ------- .../Extensions.GetProviderTypes.cs | 35 ------------ .../SourceGeneratorExtensions.cs | 21 -------- .../SymbolVisitor/ExportedTypesCollector.cs | 48 ----------------- .../Azure.KeepWarm/Azure.KeepWarm.csproj | 26 --------- .../KeepWarmFunctionAttribute.cs | 17 ------ .../KeepWarmFunctionExtensions.cs | 12 ----- .../Azure.Swagger/Azure.Swagger.csproj | 5 +- .../SwaggerFunction/SwaggerFunction.cs | 2 +- 58 files changed, 112 insertions(+), 798 deletions(-) delete mode 100644 src/health-check/Azure.HealthCheck.Generator/Azure.HealthCheck.Generator.csproj delete mode 100644 src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/Builder.BuildFunction.cs delete mode 100644 src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/HealthCheckFunctionBuilder.cs delete mode 100644 src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionSourceGenerator.cs delete mode 100644 src/health-check/Azure.HealthCheck.Generator/Metadata/HealthCheckMetadata.cs delete mode 100644 src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs delete mode 100644 src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs delete mode 100644 src/health-check/Azure.HealthCheck.Generator/SymbolVisitor/ExportedTypesCollector.cs delete mode 100644 src/health-check/Azure.HealthCheck/Azure.HealthCheck.csproj delete mode 100644 src/health-check/Azure.HealthCheck/HealthCheckFuncAttribute.cs delete mode 100644 src/health-check/Azure.HealthCheck/HealthCheckFunction.cs delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/Azure.KeepWarm.Generator.csproj delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/Builder.BuildFunction.cs delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/KeepWarmFunctionBuilder.cs delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionSourceGenerator.cs delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/Metadata/KeepWarmMetadata.cs delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs delete mode 100644 src/keep-warm/Azure.KeepWarm.Generator/SymbolVisitor/ExportedTypesCollector.cs delete mode 100644 src/keep-warm/Azure.KeepWarm/Azure.KeepWarm.csproj delete mode 100644 src/keep-warm/Azure.KeepWarm/KeepWarmFunctionAttribute.cs delete mode 100644 src/keep-warm/Azure.KeepWarm/KeepWarmFunctionExtensions.cs diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 2b0a1fd..58ec734 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -123,50 +123,6 @@ jobs: - name: Pack Azure.DurableTask run: dotnet pack ./src/*/*/Azure.DurableTask.csproj --no-restore -o ~/nuget -c Release - # Azure.KeepWarm.Generator - - - name: Restore Azure.KeepWarm.Generator - run: dotnet restore ./src/*/*/Azure.KeepWarm.Generator.csproj - - - name: Build Azure.KeepWarm.Generator - run: dotnet build ./src/*/*/Azure.KeepWarm.Generator.csproj --no-restore -c Release - - - name: Pack Azure.KeepWarm.Generator - run: dotnet pack ./src/*/*/Azure.KeepWarm.Generator.csproj --no-restore -o ~/nuget -c Release - - # Azure.KeepWarm - - - name: Restore Azure.KeepWarm - run: dotnet restore ./src/*/*/Azure.KeepWarm.csproj - - - name: Build Azure.KeepWarm - run: dotnet build ./src/*/*/Azure.KeepWarm.csproj --no-restore -c Release - - - name: Pack Azure.KeepWarm - run: dotnet pack ./src/*/*/Azure.KeepWarm.csproj --no-restore -o ~/nuget -c Release - - # Azure.HealthCheck.Generator - - - name: Restore Azure.HealthCheck.Generator - run: dotnet restore ./src/*/*/Azure.HealthCheck.Generator.csproj - - - name: Build Azure.HealthCheck.Generator - run: dotnet build ./src/*/*/Azure.HealthCheck.Generator.csproj --no-restore -c Release - - - name: Pack Azure.HealthCheck.Generator - run: dotnet pack ./src/*/*/Azure.HealthCheck.Generator.csproj --no-restore -o ~/nuget -c Release - - # Azure.HealthCheck - - - name: Restore Azure.HealthCheck - run: dotnet restore ./src/*/*/Azure.HealthCheck.csproj - - - name: Build Azure.HealthCheck - run: dotnet build ./src/*/*/Azure.HealthCheck.csproj --no-restore -c Release - - - name: Pack Azure.HealthCheck - run: dotnet pack ./src/*/*/Azure.HealthCheck.csproj --no-restore -o ~/nuget -c Release - # Push - name: Push Packages diff --git a/src/Infra.Azure.sln b/src/Infra.Azure.sln index 493635d..057f3c2 100644 --- a/src/Infra.Azure.sln +++ b/src/Infra.Azure.sln @@ -15,12 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Handler", "handler\Az EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Handler.Generator", "handler\Azure.Handler.Generator\Azure.Handler.Generator.csproj", "{63CA44BE-1953-4367-B05F-3E1B06BF6A6E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "keep-warm", "keep-warm", "{187BBAAA-B293-46DA-82CA-E20C566170A4}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.KeepWarm.Generator", "keep-warm\Azure.KeepWarm.Generator\Azure.KeepWarm.Generator.csproj", "{93F9146A-12D4-4CDD-B014-D9AEFCB6327F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.KeepWarm", "keep-warm\Azure.KeepWarm\Azure.KeepWarm.csproj", "{39E7426A-CE75-4178-B76C-F802DC1083ED}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "swagger", "swagger", "{EAE08C3A-D84B-4AAE-AB6F-9D0F71ABC333}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Swagger", "swagger\Azure.Swagger\Azure.Swagger.csproj", "{A4E2FD90-B0AC-4E58-8AF4-1F17D1016206}" @@ -31,12 +25,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Endpoint.Generator", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Endpoint", "endpoint\Azure.Endpoint\Azure.Endpoint.csproj", "{3FD09394-45D0-4DD9-899C-8AB05926E103}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "health-check", "health-check", "{6971B67D-D70D-488E-B64B-D6240B520A27}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.HealthCheck", "health-check\Azure.HealthCheck\Azure.HealthCheck.csproj", "{8F6FFF47-F4B6-4D12-8D87-E3852B37AFBB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.HealthCheck.Generator", "health-check\Azure.HealthCheck.Generator\Azure.HealthCheck.Generator.csproj", "{13773C15-8E0A-4FF7-ACF2-5435749C0F5E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hosting", "hosting", "{E06F1C49-3CBC-4F24-8178-3A6B78D5B464}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Hosting", "hosting\Azure.Hosting\Azure.Hosting.csproj", "{04DA36C0-C56F-407D-81CE-31CD192BAC50}" @@ -63,14 +51,6 @@ Global {63CA44BE-1953-4367-B05F-3E1B06BF6A6E}.Debug|Any CPU.Build.0 = Debug|Any CPU {63CA44BE-1953-4367-B05F-3E1B06BF6A6E}.Release|Any CPU.ActiveCfg = Release|Any CPU {63CA44BE-1953-4367-B05F-3E1B06BF6A6E}.Release|Any CPU.Build.0 = Release|Any CPU - {93F9146A-12D4-4CDD-B014-D9AEFCB6327F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {93F9146A-12D4-4CDD-B014-D9AEFCB6327F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {93F9146A-12D4-4CDD-B014-D9AEFCB6327F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {93F9146A-12D4-4CDD-B014-D9AEFCB6327F}.Release|Any CPU.Build.0 = Release|Any CPU - {39E7426A-CE75-4178-B76C-F802DC1083ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39E7426A-CE75-4178-B76C-F802DC1083ED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39E7426A-CE75-4178-B76C-F802DC1083ED}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39E7426A-CE75-4178-B76C-F802DC1083ED}.Release|Any CPU.Build.0 = Release|Any CPU {A4E2FD90-B0AC-4E58-8AF4-1F17D1016206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A4E2FD90-B0AC-4E58-8AF4-1F17D1016206}.Debug|Any CPU.Build.0 = Debug|Any CPU {A4E2FD90-B0AC-4E58-8AF4-1F17D1016206}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -83,14 +63,6 @@ Global {3FD09394-45D0-4DD9-899C-8AB05926E103}.Debug|Any CPU.Build.0 = Debug|Any CPU {3FD09394-45D0-4DD9-899C-8AB05926E103}.Release|Any CPU.ActiveCfg = Release|Any CPU {3FD09394-45D0-4DD9-899C-8AB05926E103}.Release|Any CPU.Build.0 = Release|Any CPU - {8F6FFF47-F4B6-4D12-8D87-E3852B37AFBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8F6FFF47-F4B6-4D12-8D87-E3852B37AFBB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8F6FFF47-F4B6-4D12-8D87-E3852B37AFBB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8F6FFF47-F4B6-4D12-8D87-E3852B37AFBB}.Release|Any CPU.Build.0 = Release|Any CPU - {13773C15-8E0A-4FF7-ACF2-5435749C0F5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13773C15-8E0A-4FF7-ACF2-5435749C0F5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13773C15-8E0A-4FF7-ACF2-5435749C0F5E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13773C15-8E0A-4FF7-ACF2-5435749C0F5E}.Release|Any CPU.Build.0 = Release|Any CPU {04DA36C0-C56F-407D-81CE-31CD192BAC50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {04DA36C0-C56F-407D-81CE-31CD192BAC50}.Debug|Any CPU.Build.0 = Debug|Any CPU {04DA36C0-C56F-407D-81CE-31CD192BAC50}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -104,13 +76,9 @@ Global {6A45A9B3-39F3-43C9-B4EB-8EE4A8D4FF92} = {6E30404F-E85C-4518-950F-0CE886843BCA} {C02257B9-3134-4EDB-BD7A-65F9D8BEE1BB} = {7DFD1749-0C57-4D4E-8F23-1487F5B4640C} {63CA44BE-1953-4367-B05F-3E1B06BF6A6E} = {7DFD1749-0C57-4D4E-8F23-1487F5B4640C} - {93F9146A-12D4-4CDD-B014-D9AEFCB6327F} = {187BBAAA-B293-46DA-82CA-E20C566170A4} - {39E7426A-CE75-4178-B76C-F802DC1083ED} = {187BBAAA-B293-46DA-82CA-E20C566170A4} {A4E2FD90-B0AC-4E58-8AF4-1F17D1016206} = {EAE08C3A-D84B-4AAE-AB6F-9D0F71ABC333} {768CF06F-CD38-4620-A647-E544C02D6128} = {36301971-7705-42B3-A42D-4F4D80CA4B77} {3FD09394-45D0-4DD9-899C-8AB05926E103} = {36301971-7705-42B3-A42D-4F4D80CA4B77} - {8F6FFF47-F4B6-4D12-8D87-E3852B37AFBB} = {6971B67D-D70D-488E-B64B-D6240B520A27} - {13773C15-8E0A-4FF7-ACF2-5435749C0F5E} = {6971B67D-D70D-488E-B64B-D6240B520A27} {04DA36C0-C56F-407D-81CE-31CD192BAC50} = {E06F1C49-3CBC-4F24-8178-3A6B78D5B464} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/durable-task/Azure.DurableTask.Generator/Azure.DurableTask.Generator.csproj b/src/durable-task/Azure.DurableTask.Generator/Azure.DurableTask.Generator.csproj index afd2fd2..749dd29 100644 --- a/src/durable-task/Azure.DurableTask.Generator/Azure.DurableTask.Generator.csproj +++ b/src/durable-task/Azure.DurableTask.Generator/Azure.DurableTask.Generator.csproj @@ -10,7 +10,7 @@ true GarageGroup.Infra GarageGroup.Infra.Azure.DurableTask.Generator - 0.3.0 + 0.4.0 @@ -18,7 +18,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/durable-task/Azure.DurableTask.Generator/DurableHandlerFunctionSourceGenerator.cs b/src/durable-task/Azure.DurableTask.Generator/DurableHandlerFunctionSourceGenerator.cs index 428edfb..f352825 100644 --- a/src/durable-task/Azure.DurableTask.Generator/DurableHandlerFunctionSourceGenerator.cs +++ b/src/durable-task/Azure.DurableTask.Generator/DurableHandlerFunctionSourceGenerator.cs @@ -10,12 +10,12 @@ public sealed class DurableHandlerFunctionSourceGenerator : HandlerFunctionSourc static DurableHandlerFunctionSourceGenerator() => - DataProviders = new IFunctionDataProvider[] - { + DataProviders = + [ new ActivityFunctionDataProvider(), new EntityFunctionDataProvider(), new OrchestrationFunctionDataProvider() - }; + ]; protected override HandlerFunctionProvider GetFunctionProvider() => diff --git a/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/ActivityFunctionDataProvider.cs b/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/ActivityFunctionDataProvider.cs index 688d4a9..916d222 100644 --- a/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/ActivityFunctionDataProvider.cs +++ b/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/ActivityFunctionDataProvider.cs @@ -12,16 +12,16 @@ internal sealed class ActivityFunctionDataProvider : IFunctionDataProvider } return new( - namespaces: new[] - { + namespaces: + [ "System.Text.Json", "System.Threading", "System.Threading.Tasks" - }, + ], responseTypeDisplayName: $"Task>", extensionsMethodName: "RunAzureFunctionAsync", - arguments: new FunctionArgumentMetadata[] - { + arguments: + [ new( namespaces: default, typeDisplayName: "JsonElement", @@ -29,14 +29,14 @@ internal sealed class ActivityFunctionDataProvider : IFunctionDataProvider orderNumber: int.MinValue, extensionMethodArgumentOrder: int.MinValue, resolverMethodArgumentOrder: null, - attributes: new FunctionAttributeMetadata[] - { + attributes: + [ new( namespaces: default, typeDisplayName: "ActivityTrigger", constructorArgumentSourceCodes: default, propertySourceCodes: default), - }), + ]), new( namespaces: default, typeDisplayName: "FunctionContext", @@ -53,6 +53,6 @@ internal sealed class ActivityFunctionDataProvider : IFunctionDataProvider extensionMethodArgumentOrder: int.MaxValue, resolverMethodArgumentOrder: null, attributes: default) - }); + ]); } } \ No newline at end of file diff --git a/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/EntityFunctionDataProvider.cs b/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/EntityFunctionDataProvider.cs index 3d4e32f..f695916 100644 --- a/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/EntityFunctionDataProvider.cs +++ b/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/EntityFunctionDataProvider.cs @@ -22,20 +22,20 @@ internal sealed class EntityFunctionDataProvider : IFunctionDataProvider } return new( - namespaces: new[] - { + namespaces: + [ "System.Threading", "System.Threading.Tasks", "Microsoft.Azure.Functions.Worker" - }, + ], responseTypeDisplayName: string.Equals("Unit", context.OutputType.DisplayedTypeName, StringComparison.Ordinal) switch { true => "Task", _ => $"Task<{context.OutputType.DisplayedTypeName}>" }, extensionsMethodName: "RunEntityFunctionAsync", - arguments: new FunctionArgumentMetadata[] - { + arguments: + [ new( namespaces: default, typeDisplayName: "TaskEntityDispatcher", @@ -67,6 +67,6 @@ internal sealed class EntityFunctionDataProvider : IFunctionDataProvider extensionMethodArgumentOrder: int.MaxValue, resolverMethodArgumentOrder: null, attributes: default) - }); + ]); } } \ No newline at end of file diff --git a/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/OrchestrationFunctionDataProvider.cs b/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/OrchestrationFunctionDataProvider.cs index 4f48cb0..8a94dce 100644 --- a/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/OrchestrationFunctionDataProvider.cs +++ b/src/durable-task/Azure.DurableTask.Generator/FunctionDataProvider/OrchestrationFunctionDataProvider.cs @@ -13,20 +13,20 @@ internal sealed class OrchestrationFunctionDataProvider : IFunctionDataProvider } return new( - namespaces: new[] - { + namespaces: + [ "System.Threading", "System.Threading.Tasks", "Microsoft.DurableTask" - }, + ], responseTypeDisplayName: string.Equals("Unit", context.OutputType.DisplayedTypeName, StringComparison.Ordinal) switch { true => "Task", _ => $"Task<{context.OutputType.DisplayedTypeName}>" }, extensionsMethodName: "RunOrchestrationFunctionAsync", - arguments: new FunctionArgumentMetadata[] - { + arguments: + [ new( namespaces: default, typeDisplayName: "TaskOrchestrationContext", @@ -34,14 +34,14 @@ internal sealed class OrchestrationFunctionDataProvider : IFunctionDataProvider orderNumber: int.MinValue, extensionMethodArgumentOrder: int.MinValue, resolverMethodArgumentOrder: null, - attributes: new FunctionAttributeMetadata[] - { + attributes: + [ new( namespaces: default, typeDisplayName: "OrchestrationTrigger", constructorArgumentSourceCodes: default, propertySourceCodes: default), - }), + ]), new( namespaces: default, typeDisplayName: "FunctionContext", @@ -58,6 +58,6 @@ internal sealed class OrchestrationFunctionDataProvider : IFunctionDataProvider extensionMethodArgumentOrder: int.MaxValue, resolverMethodArgumentOrder: null, attributes: default) - }); + ]); } } \ No newline at end of file diff --git a/src/durable-task/Azure.DurableTask/Annotation/ActivityFunctionAttribute.cs b/src/durable-task/Azure.DurableTask/Annotation/ActivityFunctionAttribute.cs index c662eb6..3c3abff 100644 --- a/src/durable-task/Azure.DurableTask/Annotation/ActivityFunctionAttribute.cs +++ b/src/durable-task/Azure.DurableTask/Annotation/ActivityFunctionAttribute.cs @@ -3,9 +3,6 @@ namespace GarageGroup.Infra; [AttributeUsage(AttributeTargets.Method)] -public sealed class ActivityFunctionAttribute : HandlerFunctionAttribute +public sealed class ActivityFunctionAttribute(string name) : HandlerFunctionAttribute(name) { - public ActivityFunctionAttribute(string name) : base(name) - { - } } \ No newline at end of file diff --git a/src/durable-task/Azure.DurableTask/Annotation/EntityFunctionAttribute.cs b/src/durable-task/Azure.DurableTask/Annotation/EntityFunctionAttribute.cs index d75d00c..8917464 100644 --- a/src/durable-task/Azure.DurableTask/Annotation/EntityFunctionAttribute.cs +++ b/src/durable-task/Azure.DurableTask/Annotation/EntityFunctionAttribute.cs @@ -3,11 +3,7 @@ namespace GarageGroup.Infra; [AttributeUsage(AttributeTargets.Method)] -public sealed class EntityFunctionAttribute : HandlerFunctionAttribute +public sealed class EntityFunctionAttribute(string name) : HandlerFunctionAttribute(name) { - public EntityFunctionAttribute(string name) : base(name) - { - } - public string? EntityName { get; set; } } \ No newline at end of file diff --git a/src/durable-task/Azure.DurableTask/Annotation/OrchestrationFunctionAttribute.cs b/src/durable-task/Azure.DurableTask/Annotation/OrchestrationFunctionAttribute.cs index e3079db..d4a9569 100644 --- a/src/durable-task/Azure.DurableTask/Annotation/OrchestrationFunctionAttribute.cs +++ b/src/durable-task/Azure.DurableTask/Annotation/OrchestrationFunctionAttribute.cs @@ -3,9 +3,6 @@ namespace GarageGroup.Infra; [AttributeUsage(AttributeTargets.Method)] -public sealed class OrchestrationFunctionAttribute : HandlerFunctionAttribute +public sealed class OrchestrationFunctionAttribute(string name) : HandlerFunctionAttribute(name) { - public OrchestrationFunctionAttribute(string name) : base(name) - { - } } \ No newline at end of file diff --git a/src/durable-task/Azure.DurableTask/Api.Activity/OrchestrationActivityApi.cs b/src/durable-task/Azure.DurableTask/Api.Activity/OrchestrationActivityApi.cs index 232bfce..a67a7c5 100644 --- a/src/durable-task/Azure.DurableTask/Api.Activity/OrchestrationActivityApi.cs +++ b/src/durable-task/Azure.DurableTask/Api.Activity/OrchestrationActivityApi.cs @@ -22,7 +22,7 @@ internal OrchestrationActivityApi(TaskOrchestrationContext context, Orchestratio return null; } - return new TaskOptions( + return new( retry: new RetryPolicy( maxNumberOfAttempts: option.MaxNumberOfAttempts, firstRetryInterval: option.FirstRetryInterval, diff --git a/src/durable-task/Azure.DurableTask/Azure.DurableTask.csproj b/src/durable-task/Azure.DurableTask/Azure.DurableTask.csproj index b2cde9f..4405891 100644 --- a/src/durable-task/Azure.DurableTask/Azure.DurableTask.csproj +++ b/src/durable-task/Azure.DurableTask/Azure.DurableTask.csproj @@ -2,13 +2,14 @@ net7.0;net8.0 + latest disable enable true true GarageGroup.Infra GarageGroup.Infra.Azure.DurableTask - 0.5.3 + 0.6.0 @@ -19,11 +20,11 @@ - + - + diff --git a/src/endpoint/Azure.Endpoint.Generator/Azure.Endpoint.Generator.csproj b/src/endpoint/Azure.Endpoint.Generator/Azure.Endpoint.Generator.csproj index 8cf6155..d6d52fd 100644 --- a/src/endpoint/Azure.Endpoint.Generator/Azure.Endpoint.Generator.csproj +++ b/src/endpoint/Azure.Endpoint.Generator/Azure.Endpoint.Generator.csproj @@ -10,7 +10,7 @@ true GarageGroup.Infra GarageGroup.Infra.Azure.Endpoint.Generator - 0.6.0 + 0.7.0 @@ -19,7 +19,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/endpoint/Azure.Endpoint.Generator/Metadata/EndpointResolverMetadata.cs b/src/endpoint/Azure.Endpoint.Generator/Metadata/EndpointResolverMetadata.cs index 4db4546..49275b1 100644 --- a/src/endpoint/Azure.Endpoint.Generator/Metadata/EndpointResolverMetadata.cs +++ b/src/endpoint/Azure.Endpoint.Generator/Metadata/EndpointResolverMetadata.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace GarageGroup.Infra; @@ -22,7 +21,7 @@ public EndpointResolverMetadata( DependencyFieldName = dependencyFieldName; FunctionName = functionName ?? string.Empty; AuthorizationLevel = authorizationLevel; - HttpMethodNames = httpMethodNames ?? Array.Empty(); + HttpMethodNames = httpMethodNames ?? []; HttpRoute = string.IsNullOrEmpty(httpRoute) ? null : httpRoute; ObsoleteData = obsoleteData; } diff --git a/src/endpoint/Azure.Endpoint.Generator/Metadata/FunctionProviderMetadata.cs b/src/endpoint/Azure.Endpoint.Generator/Metadata/FunctionProviderMetadata.cs index e96b7f6..9767c13 100644 --- a/src/endpoint/Azure.Endpoint.Generator/Metadata/FunctionProviderMetadata.cs +++ b/src/endpoint/Azure.Endpoint.Generator/Metadata/FunctionProviderMetadata.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace GarageGroup.Infra; @@ -14,7 +13,7 @@ internal FunctionProviderMetadata( Namespace = @namespace ?? string.Empty; TypeName = typeName ?? string.Empty; ProviderType = providerType; - ResolverTypes = resolverTypes ?? Array.Empty(); + ResolverTypes = resolverTypes ?? []; } public string Namespace { get; } diff --git a/src/endpoint/Azure.Endpoint.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs b/src/endpoint/Azure.Endpoint.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs index 740c784..66eddba 100644 --- a/src/endpoint/Azure.Endpoint.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs +++ b/src/endpoint/Azure.Endpoint.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs @@ -172,7 +172,7 @@ static bool IsSecurityAttribute(AttributeData attributeData) return null; } - return new[] { method ?? string.Empty }; + return [method ?? string.Empty]; } private static string? GetHttpRoute(this AttributeData endpointAttribute) diff --git a/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionAttribute.cs b/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionAttribute.cs index a189155..63625a9 100644 --- a/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionAttribute.cs +++ b/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionAttribute.cs @@ -3,11 +3,7 @@ namespace GarageGroup.Infra; [AttributeUsage(AttributeTargets.Method)] -public sealed class EndpointFunctionAttribute : Attribute +public sealed class EndpointFunctionAttribute(string name) : Attribute { - public EndpointFunctionAttribute(string name) - => - Name = name ?? string.Empty; - - public string Name { get; } + public string Name { get; } = name ?? string.Empty; } \ No newline at end of file diff --git a/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionSecurityAttribute.cs b/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionSecurityAttribute.cs index 1609a0c..dd2bcb4 100644 --- a/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionSecurityAttribute.cs +++ b/src/endpoint/Azure.Endpoint/Annotations/EndpointFunctionSecurityAttribute.cs @@ -3,11 +3,7 @@ namespace GarageGroup.Infra; [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] -public sealed class EndpointFunctionSecurityAttribute : Attribute +public sealed class EndpointFunctionSecurityAttribute(FunctionAuthorizationLevel level) : Attribute { - public EndpointFunctionSecurityAttribute(FunctionAuthorizationLevel level) - => - Level = level; - - public FunctionAuthorizationLevel Level { get; } + public FunctionAuthorizationLevel Level { get; } = level; } \ No newline at end of file diff --git a/src/endpoint/Azure.Endpoint/Azure.Endpoint.csproj b/src/endpoint/Azure.Endpoint/Azure.Endpoint.csproj index 4c2a938..dabf259 100644 --- a/src/endpoint/Azure.Endpoint/Azure.Endpoint.csproj +++ b/src/endpoint/Azure.Endpoint/Azure.Endpoint.csproj @@ -2,13 +2,14 @@ net7.0;net8.0 + latest disable enable true true GarageGroup.Infra GarageGroup.Infra.Azure.Endpoint - 0.11.0 + 0.12.0 @@ -19,9 +20,8 @@ - - - + + \ No newline at end of file diff --git a/src/endpoint/Azure.Endpoint/FunctionSwaggerBuilder/Builder.AddFunction.cs b/src/endpoint/Azure.Endpoint/FunctionSwaggerBuilder/Builder.AddFunction.cs index e7440f3..b17e2bc 100644 --- a/src/endpoint/Azure.Endpoint/FunctionSwaggerBuilder/Builder.AddFunction.cs +++ b/src/endpoint/Azure.Endpoint/FunctionSwaggerBuilder/Builder.AddFunction.cs @@ -13,7 +13,7 @@ public FunctionSwaggerBuilder AddFunctionEndpoint(EndpointMetadata endpointMetad return this; } - document.Paths ??= new OpenApiPaths(); + document.Paths ??= []; var pathItem = GetOrCreatePathItem(document.Paths, endpointMetadata); var operationType = ToOperationType(endpointMetadata.Method); diff --git a/src/handler/Azure.Handler.Generator/Azure.Handler.Generator.csproj b/src/handler/Azure.Handler.Generator/Azure.Handler.Generator.csproj index 8b222c0..2dedd84 100644 --- a/src/handler/Azure.Handler.Generator/Azure.Handler.Generator.csproj +++ b/src/handler/Azure.Handler.Generator/Azure.Handler.Generator.csproj @@ -10,7 +10,7 @@ true GarageGroup.Infra GarageGroup.Infra.Azure.Handler.Generator - 0.7.1 + 0.8.0 @@ -19,7 +19,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/EventGridFunctionDataProvider.cs b/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/EventGridFunctionDataProvider.cs index b8c1184..4344dc9 100644 --- a/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/EventGridFunctionDataProvider.cs +++ b/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/EventGridFunctionDataProvider.cs @@ -12,16 +12,16 @@ internal sealed class EventGridFunctionDataProvider : IFunctionDataProvider } return new( - namespaces: new[] - { + namespaces: + [ "System.Text.Json", "System.Threading", "System.Threading.Tasks" - }, + ], responseTypeDisplayName: "Task", extensionsMethodName: "RunAzureFunctionAsync", - arguments: new FunctionArgumentMetadata[] - { + arguments: + [ new( namespaces: default, typeDisplayName: "JsonElement", @@ -29,14 +29,14 @@ internal sealed class EventGridFunctionDataProvider : IFunctionDataProvider orderNumber: int.MinValue, extensionMethodArgumentOrder: int.MinValue, resolverMethodArgumentOrder: null, - attributes: new FunctionAttributeMetadata[] - { + attributes: + [ new( namespaces: default, typeDisplayName: "EventGridTrigger", constructorArgumentSourceCodes: default, propertySourceCodes: default), - }), + ]), new( namespaces: default, typeDisplayName: "FunctionContext", @@ -53,6 +53,6 @@ internal sealed class EventGridFunctionDataProvider : IFunctionDataProvider extensionMethodArgumentOrder: int.MaxValue, resolverMethodArgumentOrder: null, attributes: default) - }); + ]); } } \ No newline at end of file diff --git a/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/HttpFunctionDataProvider.cs b/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/HttpFunctionDataProvider.cs index d6b27b5..77ef9ea 100644 --- a/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/HttpFunctionDataProvider.cs +++ b/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/HttpFunctionDataProvider.cs @@ -15,16 +15,16 @@ internal sealed class HttpFunctionDataProvider : IFunctionDataProvider } return new( - namespaces: new[] - { + namespaces: + [ "Microsoft.Azure.Functions.Worker.Http", "System.Threading", "System.Threading.Tasks" - }, + ], responseTypeDisplayName: "Task", extensionsMethodName: "RunHttpFunctionAsync", - arguments: new FunctionArgumentMetadata[] - { + arguments: + [ new( namespaces: default, typeDisplayName: "HttpRequestData", @@ -32,10 +32,10 @@ internal sealed class HttpFunctionDataProvider : IFunctionDataProvider orderNumber: int.MinValue, extensionMethodArgumentOrder: int.MinValue, resolverMethodArgumentOrder: null, - attributes: new[] - { + attributes: + [ BuildHttpTriggerAttributeMetadata(functionAttribute) - }), + ]), new( namespaces: default, typeDisplayName: "CancellationToken", @@ -44,7 +44,7 @@ internal sealed class HttpFunctionDataProvider : IFunctionDataProvider extensionMethodArgumentOrder: int.MaxValue, resolverMethodArgumentOrder: null, attributes: default) - }); + ]); } private static FunctionAttributeMetadata BuildHttpTriggerAttributeMetadata(AttributeData httpAttribute) @@ -72,11 +72,11 @@ private static FunctionAttributeMetadata BuildHttpTriggerAttributeMetadata(Attri return new( namespaces: default, typeDisplayName: "HttpTrigger", - constructorArgumentSourceCodes: new[] - { + constructorArgumentSourceCodes: + [ authorizationLevelSourceCode, method.AsStringSourceCodeOr() - }, + ], propertySourceCodes: properties.ToArray()); } diff --git a/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/ServiceBusFunctionDataProvider.cs b/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/ServiceBusFunctionDataProvider.cs index 35e895c..bf30152 100644 --- a/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/ServiceBusFunctionDataProvider.cs +++ b/src/handler/Azure.Handler.Generator/FunctionDataProvider/Function/ServiceBusFunctionDataProvider.cs @@ -19,16 +19,16 @@ internal sealed class ServiceBusFunctionDataProvider : IFunctionDataProvider } return new( - namespaces: new[] - { + namespaces: + [ "System.Text.Json", "System.Threading", "System.Threading.Tasks" - }, + ], responseTypeDisplayName: "Task", extensionsMethodName: "RunAzureFunctionAsync", - arguments: new FunctionArgumentMetadata[] - { + arguments: + [ new( namespaces: default, typeDisplayName: "JsonElement", @@ -36,10 +36,10 @@ internal sealed class ServiceBusFunctionDataProvider : IFunctionDataProvider orderNumber: int.MinValue, extensionMethodArgumentOrder: int.MinValue, resolverMethodArgumentOrder: null, - attributes: new[] - { + attributes: + [ BuildServiceBusTriggerAttributeMetadata(functionAttribute) - }), + ]), new( namespaces: default, typeDisplayName: "FunctionContext", @@ -56,7 +56,7 @@ internal sealed class ServiceBusFunctionDataProvider : IFunctionDataProvider extensionMethodArgumentOrder: int.MaxValue, resolverMethodArgumentOrder: null, attributes: default) - }); + ]); } private static FunctionAttributeMetadata BuildServiceBusTriggerAttributeMetadata(AttributeData serviceBusAttribute) diff --git a/src/handler/Azure.Handler.Generator/HandlerFunctionProvider/HandlerFunctionProvider.cs b/src/handler/Azure.Handler.Generator/HandlerFunctionProvider/HandlerFunctionProvider.cs index 6298450..893d765 100644 --- a/src/handler/Azure.Handler.Generator/HandlerFunctionProvider/HandlerFunctionProvider.cs +++ b/src/handler/Azure.Handler.Generator/HandlerFunctionProvider/HandlerFunctionProvider.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace GarageGroup.Infra; @@ -9,7 +8,7 @@ public sealed partial class HandlerFunctionProvider(IReadOnlyList functionDataProviders = - functionDataProviders ?? Array.Empty(); + functionDataProviders ?? []; private readonly string typeNameSuffix = diff --git a/src/handler/Azure.Handler.Generator/HandlerFunctionSourceGenerator.cs b/src/handler/Azure.Handler.Generator/HandlerFunctionSourceGenerator.cs index dfd22f1..65074aa 100644 --- a/src/handler/Azure.Handler.Generator/HandlerFunctionSourceGenerator.cs +++ b/src/handler/Azure.Handler.Generator/HandlerFunctionSourceGenerator.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.CodeAnalysis; namespace GarageGroup.Infra; @@ -10,12 +10,12 @@ public sealed class HandlerFunctionSourceGenerator : HandlerFunctionSourceGenera static HandlerFunctionSourceGenerator() => - DataProviders = new IFunctionDataProvider[] - { + DataProviders = + [ new HttpFunctionDataProvider(), new ServiceBusFunctionDataProvider(), new EventGridFunctionDataProvider() - }; + ]; protected override HandlerFunctionProvider GetFunctionProvider() => diff --git a/src/handler/Azure.Handler.Generator/Metadata/FunctionArgumentMetadata.cs b/src/handler/Azure.Handler.Generator/Metadata/FunctionArgumentMetadata.cs index 17821fd..33b957f 100644 --- a/src/handler/Azure.Handler.Generator/Metadata/FunctionArgumentMetadata.cs +++ b/src/handler/Azure.Handler.Generator/Metadata/FunctionArgumentMetadata.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace GarageGroup.Infra; @@ -14,13 +13,13 @@ public FunctionArgumentMetadata( int? resolverMethodArgumentOrder, IReadOnlyList? attributes) { - Namespaces = namespaces ?? Array.Empty(); + Namespaces = namespaces ?? []; TypeDisplayName = typeDisplayName ?? string.Empty; ArgumentName = argumentName ?? string.Empty; OrderNumber = orderNumber; ExtensionMethodArgumentOrder = extensionMethodArgumentOrder; ResolverMethodArgumentOrder = resolverMethodArgumentOrder; - Attributes = attributes ?? Array.Empty(); + Attributes = attributes ?? []; } public IReadOnlyList Namespaces { get; } diff --git a/src/handler/Azure.Handler.Generator/Metadata/FunctionAttributeMetadata.cs b/src/handler/Azure.Handler.Generator/Metadata/FunctionAttributeMetadata.cs index 2e18c33..099b36b 100644 --- a/src/handler/Azure.Handler.Generator/Metadata/FunctionAttributeMetadata.cs +++ b/src/handler/Azure.Handler.Generator/Metadata/FunctionAttributeMetadata.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace GarageGroup.Infra; @@ -11,10 +10,10 @@ public FunctionAttributeMetadata( IReadOnlyList? constructorArgumentSourceCodes, IReadOnlyList>? propertySourceCodes) { - Namespaces = namespaces ?? Array.Empty(); + Namespaces = namespaces ?? []; TypeDisplayName = typeDisplayName ?? string.Empty; - ConstructorArgumentSourceCodes = constructorArgumentSourceCodes ?? Array.Empty(); - PropertySourceCodes = propertySourceCodes ?? Array.Empty>(); + ConstructorArgumentSourceCodes = constructorArgumentSourceCodes ?? []; + PropertySourceCodes = propertySourceCodes ?? []; } public IReadOnlyList Namespaces { get; } diff --git a/src/handler/Azure.Handler.Generator/Metadata/FunctionProviderMetadata.cs b/src/handler/Azure.Handler.Generator/Metadata/FunctionProviderMetadata.cs index 74869e5..5f37aed 100644 --- a/src/handler/Azure.Handler.Generator/Metadata/FunctionProviderMetadata.cs +++ b/src/handler/Azure.Handler.Generator/Metadata/FunctionProviderMetadata.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace GarageGroup.Infra; @@ -14,7 +13,7 @@ internal FunctionProviderMetadata( Namespace = @namespace ?? string.Empty; TypeName = typeName ?? string.Empty; ProviderType = providerType; - ResolverTypes = resolverTypes ?? Array.Empty(); + ResolverTypes = resolverTypes ?? []; } public string Namespace { get; } diff --git a/src/handler/Azure.Handler.Generator/Metadata/HandlerFunctionMetadata.cs b/src/handler/Azure.Handler.Generator/Metadata/HandlerFunctionMetadata.cs index aa3c092..4c97811 100644 --- a/src/handler/Azure.Handler.Generator/Metadata/HandlerFunctionMetadata.cs +++ b/src/handler/Azure.Handler.Generator/Metadata/HandlerFunctionMetadata.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace GarageGroup.Infra; @@ -11,10 +10,10 @@ public HandlerFunctionMetadata( string extensionsMethodName, IReadOnlyList arguments) { - Namespaces = namespaces ?? Array.Empty(); + Namespaces = namespaces ?? []; ResponseTypeDisplayName = responseTypeDisplayName ?? string.Empty; ExtensionsMethodName = extensionsMethodName ?? string.Empty; - Arguments = arguments ?? Array.Empty(); + Arguments = arguments ?? []; } public IReadOnlyList Namespaces { get; } diff --git a/src/handler/Azure.Handler/Annotations/Function/HttpFunctionAttribute.cs b/src/handler/Azure.Handler/Annotations/Function/HttpFunctionAttribute.cs index d7e7755..9f7747b 100644 --- a/src/handler/Azure.Handler/Annotations/Function/HttpFunctionAttribute.cs +++ b/src/handler/Azure.Handler/Annotations/Function/HttpFunctionAttribute.cs @@ -3,13 +3,9 @@ namespace GarageGroup.Infra; [AttributeUsage(AttributeTargets.Method)] -public sealed class HttpFunctionAttribute : HandlerFunctionAttribute +public sealed class HttpFunctionAttribute(string name, string method = HttpMethodName.Post) : HandlerFunctionAttribute(name) { - public HttpFunctionAttribute(string name, string method = HttpMethodName.Post) : base(name) - => - Method = method ?? string.Empty; - - public string Method { get; } + public string Method { get; } = method ?? string.Empty; public string? Route { get; set; } diff --git a/src/handler/Azure.Handler/Annotations/HandlerFunctionAttribute.cs b/src/handler/Azure.Handler/Annotations/HandlerFunctionAttribute.cs index b344c3d..22111ee 100644 --- a/src/handler/Azure.Handler/Annotations/HandlerFunctionAttribute.cs +++ b/src/handler/Azure.Handler/Annotations/HandlerFunctionAttribute.cs @@ -3,11 +3,7 @@ namespace GarageGroup.Infra; [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] -public abstract class HandlerFunctionAttribute : Attribute +public abstract class HandlerFunctionAttribute(string name) : Attribute { - public HandlerFunctionAttribute(string name) - => - Name = name ?? string.Empty; - - public string Name { get; } + public string Name { get; } = name ?? string.Empty; } \ No newline at end of file diff --git a/src/handler/Azure.Handler/Azure.Handler.csproj b/src/handler/Azure.Handler/Azure.Handler.csproj index c09381a..5e30067 100644 --- a/src/handler/Azure.Handler/Azure.Handler.csproj +++ b/src/handler/Azure.Handler/Azure.Handler.csproj @@ -2,13 +2,14 @@ net7.0;net8.0 + latest disable enable true true GarageGroup.Infra GarageGroup.Infra.Azure.Handler - 0.12.3 + 0.13.0 @@ -21,7 +22,7 @@ - + diff --git a/src/health-check/Azure.HealthCheck.Generator/Azure.HealthCheck.Generator.csproj b/src/health-check/Azure.HealthCheck.Generator/Azure.HealthCheck.Generator.csproj deleted file mode 100644 index d0c6a9a..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/Azure.HealthCheck.Generator.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - netstandard2.0 - latest - disable - enable - true - true - true - GarageGroup.Infra - GarageGroup.Infra.Azure.HealthCheck.Generator - 0.4.0 - - - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/Builder.BuildFunction.cs b/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/Builder.BuildFunction.cs deleted file mode 100644 index bd4a0af..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/Builder.BuildFunction.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Text; - -namespace GarageGroup.Infra; - -partial class HealthCheckFunctionBuilder -{ - internal static string BuildFunctionSourceCode(this HealthCheckMetadata metadata) - => - new SourceBuilder( - metadata.Namespace) - .AddUsing( - "GarageGroup.Infra", - "Microsoft.Azure.Functions.Worker", - "Microsoft.Azure.Functions.Worker.Http") - .AppendCodeLine( - $"public static class {metadata.TypeName}") - .BeginCodeBlock() - .AppendCodeLine( - $"[Function({metadata.FunctionName.AsStringSourceCodeOr()})]", - $"public static HttpResponseData Run({metadata.BuildHttpTriggerAttributeSourceCode()} HttpRequestData request)") - .BeginLambda() - .AppendCodeLine( - $"HealthCheckFunction.Run(request);") - .EndLambda() - .EndCodeBlock() - .Build(); - - private static string BuildHttpTriggerAttributeSourceCode(this HealthCheckMetadata resolver) - { - var authorizationLevelSourceCode = resolver.GetAuthorizationLevelSourceCode(); - var builder = new StringBuilder("[HttpTrigger(").Append(authorizationLevelSourceCode).Append(", \"GET\""); - - if (string.IsNullOrEmpty(resolver.FunctionRoute) is false) - { - builder = builder.Append(", Route = ").Append(resolver.FunctionRoute.AsStringSourceCodeOr()); - } - - return builder.Append(")]").ToString(); - } - - private static string GetAuthorizationLevelSourceCode(this HealthCheckMetadata resolver) - => - resolver.AuthorizationLevel switch - { - 0 => "AuthorizationLevel.Anonymous", - 1 => "AuthorizationLevel.User", - 2 => "AuthorizationLevel.Function", - 3 => "AuthorizationLevel.System", - 4 => "AuthorizationLevel.Admin", - _ => "(AuthorizationLevel)" + resolver.AuthorizationLevel - }; -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/HealthCheckFunctionBuilder.cs b/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/HealthCheckFunctionBuilder.cs deleted file mode 100644 index 032b4e6..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionBuilder/HealthCheckFunctionBuilder.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace GarageGroup.Infra; - -internal static partial class HealthCheckFunctionBuilder -{ -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionSourceGenerator.cs b/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionSourceGenerator.cs deleted file mode 100644 index 75d54c0..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/HealthCheckFunctionSourceGenerator.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.CodeAnalysis; - -namespace GarageGroup.Infra; - -[Generator] -internal sealed class HealthCheckFunctionSourceGenerator : ISourceGenerator -{ - public void Execute(GeneratorExecutionContext context) - { - foreach (var providerType in context.GetHealthCheckTypes()) - { - var sourceCode = providerType.BuildFunctionSourceCode(); - context.AddSource($"{providerType.TypeName}.g.cs", sourceCode); - } - } - - public void Initialize(GeneratorInitializationContext context) - { - // No initialization required for this one - } -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck.Generator/Metadata/HealthCheckMetadata.cs b/src/health-check/Azure.HealthCheck.Generator/Metadata/HealthCheckMetadata.cs deleted file mode 100644 index cf858cc..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/Metadata/HealthCheckMetadata.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace GarageGroup.Infra; - -internal sealed record class HealthCheckMetadata -{ - public HealthCheckMetadata(string @namespace, string typeName, string functionName, string? functionRoute, int authorizationLevel) - { - Namespace = @namespace ?? string.Empty; - TypeName = typeName ?? string.Empty; - FunctionName = functionName ?? string.Empty; - FunctionRoute = functionRoute ?? string.Empty; - AuthorizationLevel = authorizationLevel; - } - - public string Namespace { get; } - - public string TypeName { get; } - - public string FunctionName { get; } - - public string? FunctionRoute { get; } - - public int AuthorizationLevel { get; } -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs b/src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs deleted file mode 100644 index caf5819..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.CodeAnalysis; - -namespace GarageGroup.Infra; - -internal static partial class SourceGeneratorExtensions -{ - internal static IReadOnlyCollection GetHealthCheckTypes(this GeneratorExecutionContext context) - { - var visitor = new ExportedTypesCollector(context.CancellationToken); - visitor.VisitNamespace(context.Compilation.GlobalNamespace); - - return visitor.GetNonPrivateTypes().Select(GetFunctionMetadata).NotNull().ToArray(); - } - - private static HealthCheckMetadata? GetFunctionMetadata(INamedTypeSymbol typeSymbol) - { - var functionAttribute = typeSymbol.GetAttributes().FirstOrDefault(IsHealthCheckFuncAttribute); - if (functionAttribute is null) - { - return null; - } - - return new( - @namespace: typeSymbol.ContainingNamespace.ToString(), - typeName: typeSymbol.Name + "HealthCheckFunction", - functionName: functionAttribute.GetAttributeValue(0)?.ToString() ?? string.Empty, - functionRoute: functionAttribute.GetAttributeValue(1)?.ToString() ?? string.Empty, - authorizationLevel: functionAttribute.GetAuthorizationLevel()); - - static bool IsHealthCheckFuncAttribute(AttributeData attributeData) - => - attributeData.AttributeClass?.IsType(DefaultNamespace, "HealthCheckFuncAttribute") is true; - } - - private static int GetAuthorizationLevel(this AttributeData functionAttribute) - { - var levelValue = functionAttribute.GetAttributePropertyValue("AuthLevel"); - if (levelValue is null) - { - return default; - } - - if (levelValue is not int level) - { - throw new InvalidOperationException($"An unexpected bot function authorization level: {levelValue}"); - } - - return level; - } -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs b/src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs deleted file mode 100644 index e06f75d..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; - -namespace GarageGroup.Infra; - -internal static partial class SourceGeneratorExtensions -{ - private const string DefaultNamespace = "GarageGroup.Infra"; - - private static IEnumerable NotNull(this IEnumerable source) - { - foreach (var item in source) - { - if (item is null) - { - continue; - } - - yield return item; - } - } -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck.Generator/SymbolVisitor/ExportedTypesCollector.cs b/src/health-check/Azure.HealthCheck.Generator/SymbolVisitor/ExportedTypesCollector.cs deleted file mode 100644 index aeee09a..0000000 --- a/src/health-check/Azure.HealthCheck.Generator/SymbolVisitor/ExportedTypesCollector.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using Microsoft.CodeAnalysis; - -namespace GarageGroup.Infra; - -internal sealed class ExportedTypesCollector : SymbolVisitor -{ - private readonly CancellationToken cancellationToken; - - private readonly HashSet exportedTypes; - - internal ExportedTypesCollector(CancellationToken cancellationToken) - { - this.cancellationToken = cancellationToken; - exportedTypes = new(SymbolEqualityComparer.Default); - } - - public IReadOnlyCollection GetNonPrivateTypes() - => - exportedTypes.ToArray(); - - public override void VisitAssembly(IAssemblySymbol symbol) - { - cancellationToken.ThrowIfCancellationRequested(); - symbol.GlobalNamespace.Accept(this); - } - - public override void VisitNamespace(INamespaceSymbol symbol) - { - foreach (INamespaceOrTypeSymbol namespaceOrType in symbol.GetMembers()) - { - cancellationToken.ThrowIfCancellationRequested(); - namespaceOrType.Accept(this); - } - } - - public override void VisitNamedType(INamedTypeSymbol type) - { - cancellationToken.ThrowIfCancellationRequested(); - - if (type.DeclaredAccessibility is Accessibility.Public or Accessibility.Internal) - { - exportedTypes.Add(type); - } - } -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck/Azure.HealthCheck.csproj b/src/health-check/Azure.HealthCheck/Azure.HealthCheck.csproj deleted file mode 100644 index 39f33e4..0000000 --- a/src/health-check/Azure.HealthCheck/Azure.HealthCheck.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - net7.0;net8.0 - disable - enable - true - true - GarageGroup.Infra - GarageGroup.Infra.Azure.HealthCheck - 0.7.0 - - - - - contentfiles; build - TargetFramework=netstandard2.0 - - - - - - - - - \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck/HealthCheckFuncAttribute.cs b/src/health-check/Azure.HealthCheck/HealthCheckFuncAttribute.cs deleted file mode 100644 index e6cab8a..0000000 --- a/src/health-check/Azure.HealthCheck/HealthCheckFuncAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Microsoft.Azure.Functions.Worker; - -namespace GarageGroup.Infra; - -[AttributeUsage(AttributeTargets.Class)] -public sealed class HealthCheckFuncAttribute : Attribute -{ - public HealthCheckFuncAttribute(string name, string route = "health") - { - Name = name ?? string.Empty; - Route = route ?? string.Empty; - } - - public string Name { get; } - - public string Route { get; } - - public AuthorizationLevel AuthLevel { get; set; } -} \ No newline at end of file diff --git a/src/health-check/Azure.HealthCheck/HealthCheckFunction.cs b/src/health-check/Azure.HealthCheck/HealthCheckFunction.cs deleted file mode 100644 index dc350af..0000000 --- a/src/health-check/Azure.HealthCheck/HealthCheckFunction.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Net; -using Microsoft.Azure.Functions.Worker.Http; - -namespace GarageGroup.Infra; - -public static class HealthCheckFunction -{ - public static HttpResponseData Run(HttpRequestData request) - { - ArgumentNullException.ThrowIfNull(request); - var response = request.CreateResponse(HttpStatusCode.OK); - - response.Headers.Add("Content-Type", "application/json"); - response.WriteString("{\"status\": \"Healthy\"}"); - - return response; - } -} \ No newline at end of file diff --git a/src/hosting/Azure.Hosting/Azure.Hosting.csproj b/src/hosting/Azure.Hosting/Azure.Hosting.csproj index e86bade..f832b8f 100644 --- a/src/hosting/Azure.Hosting/Azure.Hosting.csproj +++ b/src/hosting/Azure.Hosting/Azure.Hosting.csproj @@ -2,13 +2,14 @@ net7.0;net8.0 + latest disable enable true true GarageGroup.Infra GarageGroup.Infra.Azure.Hosting - 0.7.1 + 0.8.0 @@ -16,8 +17,8 @@ - - + + diff --git a/src/keep-warm/Azure.KeepWarm.Generator/Azure.KeepWarm.Generator.csproj b/src/keep-warm/Azure.KeepWarm.Generator/Azure.KeepWarm.Generator.csproj deleted file mode 100644 index 2ef0bf6..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/Azure.KeepWarm.Generator.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - netstandard2.0 - latest - disable - enable - true - true - true - GarageGroup.Infra - GarageGroup.Infra.Azure.KeepWarm.Generator - 0.4.0 - - - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/Builder.BuildFunction.cs b/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/Builder.BuildFunction.cs deleted file mode 100644 index d0510df..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/Builder.BuildFunction.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace GarageGroup.Infra; - -partial class KeepWarmFunctionBuilder -{ - internal static string BuildFunctionSourceCode(this KeepWarmMetadata metadata) - => - new SourceBuilder( - metadata.Namespace) - .AddUsing( - "GarageGroup.Infra", - "Microsoft.Azure.Functions.Worker") - .AppendCodeLine( - $"public static class {metadata.TypeName}") - .BeginCodeBlock() - .AppendCodeLine( - $"[Function({metadata.FunctionName.AsStringSourceCodeOr()})]", - $"public static void Run({metadata.BuildTimerTriggerAttributeSourceCode()} TimerInfo timerInfo, FunctionContext context)") - .BeginLambda() - .AppendCodeLine( - $"context?.GetLogger({metadata.FunctionName.AsStringSourceCodeOr()}).LogTimerInfo(timerInfo);") - .EndLambda() - .EndCodeBlock() - .Build(); - - private static string BuildTimerTriggerAttributeSourceCode(this KeepWarmMetadata metadata) - => - $"[TimerTrigger({metadata.FunctionSchedule.AsStringSourceCodeOr()})]"; -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/KeepWarmFunctionBuilder.cs b/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/KeepWarmFunctionBuilder.cs deleted file mode 100644 index 9dd1a47..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionBuilder/KeepWarmFunctionBuilder.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace GarageGroup.Infra; - -internal static partial class KeepWarmFunctionBuilder -{ -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionSourceGenerator.cs b/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionSourceGenerator.cs deleted file mode 100644 index 3b6092d..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/KeepWarmFunctionSourceGenerator.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.CodeAnalysis; - -namespace GarageGroup.Infra; - -[Generator] -internal sealed class KeepWarmFunctionSourceGenerator : ISourceGenerator -{ - public void Execute(GeneratorExecutionContext context) - { - foreach (var providerType in context.GetKeepWarmTypes()) - { - var sourceCode = providerType.BuildFunctionSourceCode(); - context.AddSource($"{providerType.TypeName}.g.cs", sourceCode); - } - } - - public void Initialize(GeneratorInitializationContext context) - { - // No initialization required for this one - } -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm.Generator/Metadata/KeepWarmMetadata.cs b/src/keep-warm/Azure.KeepWarm.Generator/Metadata/KeepWarmMetadata.cs deleted file mode 100644 index 3bdee1a..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/Metadata/KeepWarmMetadata.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace GarageGroup.Infra; - -internal sealed record class KeepWarmMetadata -{ - public KeepWarmMetadata(string @namespace, string typeName, string functionName, string functionSchedule) - { - Namespace = @namespace ?? string.Empty; - TypeName = typeName ?? string.Empty; - FunctionName = functionName ?? string.Empty; - FunctionSchedule = functionSchedule ?? string.Empty; - } - - public string Namespace { get; } - - public string TypeName { get; } - - public string FunctionName { get; } - - public string FunctionSchedule { get; } -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs b/src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs deleted file mode 100644 index a42e785..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/Extensions.GetProviderTypes.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Microsoft.CodeAnalysis; - -namespace GarageGroup.Infra; - -internal static partial class SourceGeneratorExtensions -{ - internal static IReadOnlyCollection GetKeepWarmTypes(this GeneratorExecutionContext context) - { - var visitor = new ExportedTypesCollector(context.CancellationToken); - visitor.VisitNamespace(context.Compilation.GlobalNamespace); - - return visitor.GetNonPrivateTypes().Select(GetFunctionMetadata).NotNull().ToArray(); - } - - private static KeepWarmMetadata? GetFunctionMetadata(INamedTypeSymbol typeSymbol) - { - var functionAttribute = typeSymbol.GetAttributes().FirstOrDefault(IsKeepWarmFunctionAttribute); - if (functionAttribute is null) - { - return null; - } - - return new( - @namespace: typeSymbol.ContainingNamespace.ToString(), - typeName: typeSymbol.Name + "WarmFunction", - functionName: functionAttribute.GetAttributeValue(0)?.ToString() ?? string.Empty, - functionSchedule: functionAttribute.GetAttributeValue(1)?.ToString() ?? string.Empty); - - static bool IsKeepWarmFunctionAttribute(AttributeData attributeData) - => - attributeData.AttributeClass?.IsType(DefaultNamespace, "KeepWarmFunctionAttribute") is true; - } -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs b/src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs deleted file mode 100644 index e06f75d..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/SourceGeneratorExtensions/SourceGeneratorExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; - -namespace GarageGroup.Infra; - -internal static partial class SourceGeneratorExtensions -{ - private const string DefaultNamespace = "GarageGroup.Infra"; - - private static IEnumerable NotNull(this IEnumerable source) - { - foreach (var item in source) - { - if (item is null) - { - continue; - } - - yield return item; - } - } -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm.Generator/SymbolVisitor/ExportedTypesCollector.cs b/src/keep-warm/Azure.KeepWarm.Generator/SymbolVisitor/ExportedTypesCollector.cs deleted file mode 100644 index aeee09a..0000000 --- a/src/keep-warm/Azure.KeepWarm.Generator/SymbolVisitor/ExportedTypesCollector.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using Microsoft.CodeAnalysis; - -namespace GarageGroup.Infra; - -internal sealed class ExportedTypesCollector : SymbolVisitor -{ - private readonly CancellationToken cancellationToken; - - private readonly HashSet exportedTypes; - - internal ExportedTypesCollector(CancellationToken cancellationToken) - { - this.cancellationToken = cancellationToken; - exportedTypes = new(SymbolEqualityComparer.Default); - } - - public IReadOnlyCollection GetNonPrivateTypes() - => - exportedTypes.ToArray(); - - public override void VisitAssembly(IAssemblySymbol symbol) - { - cancellationToken.ThrowIfCancellationRequested(); - symbol.GlobalNamespace.Accept(this); - } - - public override void VisitNamespace(INamespaceSymbol symbol) - { - foreach (INamespaceOrTypeSymbol namespaceOrType in symbol.GetMembers()) - { - cancellationToken.ThrowIfCancellationRequested(); - namespaceOrType.Accept(this); - } - } - - public override void VisitNamedType(INamedTypeSymbol type) - { - cancellationToken.ThrowIfCancellationRequested(); - - if (type.DeclaredAccessibility is Accessibility.Public or Accessibility.Internal) - { - exportedTypes.Add(type); - } - } -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm/Azure.KeepWarm.csproj b/src/keep-warm/Azure.KeepWarm/Azure.KeepWarm.csproj deleted file mode 100644 index d8b4cbf..0000000 --- a/src/keep-warm/Azure.KeepWarm/Azure.KeepWarm.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - net7.0;net8.0 - disable - enable - true - true - GarageGroup.Infra - GarageGroup.Infra.Azure.KeepWarm - 0.3.0 - - - - - contentfiles; build - TargetFramework=netstandard2.0 - - - - - - - - - \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm/KeepWarmFunctionAttribute.cs b/src/keep-warm/Azure.KeepWarm/KeepWarmFunctionAttribute.cs deleted file mode 100644 index d77b87d..0000000 --- a/src/keep-warm/Azure.KeepWarm/KeepWarmFunctionAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace GarageGroup.Infra; - -[AttributeUsage(AttributeTargets.Class)] -public sealed class KeepWarmFunctionAttribute : Attribute -{ - public KeepWarmFunctionAttribute(string name, string schedule = "0 */5 * * * *") - { - Name = name ?? string.Empty; - Schedule = schedule ?? string.Empty; - } - - public string Name { get; } - - public string Schedule { get; } -} \ No newline at end of file diff --git a/src/keep-warm/Azure.KeepWarm/KeepWarmFunctionExtensions.cs b/src/keep-warm/Azure.KeepWarm/KeepWarmFunctionExtensions.cs deleted file mode 100644 index ee94b15..0000000 --- a/src/keep-warm/Azure.KeepWarm/KeepWarmFunctionExtensions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using Microsoft.Azure.Functions.Worker; -using Microsoft.Extensions.Logging; - -namespace GarageGroup.Infra; - -public static class KeepWarmFunctionExtensions -{ - public static void LogTimerInfo([AllowNull] this ILogger logger, TimerInfo timerInfo) - => - logger?.LogDebug("Last: {last}, Next: {next}", timerInfo?.ScheduleStatus?.Last, timerInfo?.ScheduleStatus?.Next); -} \ No newline at end of file diff --git a/src/swagger/Azure.Swagger/Azure.Swagger.csproj b/src/swagger/Azure.Swagger/Azure.Swagger.csproj index 6caff7b..58cb704 100644 --- a/src/swagger/Azure.Swagger/Azure.Swagger.csproj +++ b/src/swagger/Azure.Swagger/Azure.Swagger.csproj @@ -2,20 +2,21 @@ net7.0;net8.0 + latest disable enable true true GarageGroup.Infra GarageGroup.Infra.Azure.Swagger - 0.6.1 + 0.7.0 - + diff --git a/src/swagger/Azure.Swagger/SwaggerFunction/SwaggerFunction.cs b/src/swagger/Azure.Swagger/SwaggerFunction/SwaggerFunction.cs index 43d50ba..07669c7 100644 --- a/src/swagger/Azure.Swagger/SwaggerFunction/SwaggerFunction.cs +++ b/src/swagger/Azure.Swagger/SwaggerFunction/SwaggerFunction.cs @@ -18,7 +18,7 @@ public static partial class SwaggerFunction private const string DefaultSwaggerSection = "Swagger"; - private static readonly string[] YamlFormats = new[] { "yaml", "yml" }; + private static readonly string[] YamlFormats = ["yaml", "yml"]; private static readonly Lazy LazyHtmlTemplate = new(BuildHtmlTemplate);