diff --git a/Liquid.WebApi.sln b/Liquid.WebApi.sln index 5950a65a..656405fc 100644 --- a/Liquid.WebApi.sln +++ b/Liquid.WebApi.sln @@ -5,18 +5,12 @@ VisualStudioVersion = 17.0.31612.314 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Liquid.WebApi.Http", "src\Liquid.WebApi.Http\Liquid.WebApi.Http.csproj", "{25D05D84-4DFB-4F3D-92A2-B06DFA244BA4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Liquid.WebApi.Grpc", "src\Liquid.WebApi.Grpc\Liquid.WebApi.Grpc.csproj", "{7806419C-7191-4D7A-BD52-8E705553ABEB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Liquid.WebApi.Grpc.Tests", "test\Liquid.WebApi.Grpc.Tests\Liquid.WebApi.Grpc.Tests.csproj", "{3B8464A5-3795-464E-A3B2-D2851C9E38DC}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{7B0BC311-679F-4D1F-BE49-DF3E49863792}" ProjectSection(SolutionItems) = preProject .github\workflows\liquid-ci-cd-http-extensions-crud.yml = .github\workflows\liquid-ci-cd-http-extensions-crud.yml .github\workflows\liquid-ci-cd-http.yml = .github\workflows\liquid-ci-cd-http.yml EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Grpc", "Grpc", "{15BED263-E56A-45B2-A647-7D44500383E1}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Http", "Http", "{13C213E0-722A-4CD5-9209-21E12FDA0CA8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Liquid.WebApi.Http.Tests", "test\Liquid.WebApi.Http.Tests\Liquid.WebApi.Http.Tests.csproj", "{39DDC514-44CD-43BE-9E5B-C3B86665895E}" @@ -35,14 +29,6 @@ Global {25D05D84-4DFB-4F3D-92A2-B06DFA244BA4}.Debug|Any CPU.Build.0 = Debug|Any CPU {25D05D84-4DFB-4F3D-92A2-B06DFA244BA4}.Release|Any CPU.ActiveCfg = Release|Any CPU {25D05D84-4DFB-4F3D-92A2-B06DFA244BA4}.Release|Any CPU.Build.0 = Release|Any CPU - {7806419C-7191-4D7A-BD52-8E705553ABEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7806419C-7191-4D7A-BD52-8E705553ABEB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7806419C-7191-4D7A-BD52-8E705553ABEB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7806419C-7191-4D7A-BD52-8E705553ABEB}.Release|Any CPU.Build.0 = Release|Any CPU - {3B8464A5-3795-464E-A3B2-D2851C9E38DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B8464A5-3795-464E-A3B2-D2851C9E38DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B8464A5-3795-464E-A3B2-D2851C9E38DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B8464A5-3795-464E-A3B2-D2851C9E38DC}.Release|Any CPU.Build.0 = Release|Any CPU {39DDC514-44CD-43BE-9E5B-C3B86665895E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {39DDC514-44CD-43BE-9E5B-C3B86665895E}.Debug|Any CPU.Build.0 = Debug|Any CPU {39DDC514-44CD-43BE-9E5B-C3B86665895E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -61,8 +47,6 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {25D05D84-4DFB-4F3D-92A2-B06DFA244BA4} = {13C213E0-722A-4CD5-9209-21E12FDA0CA8} - {7806419C-7191-4D7A-BD52-8E705553ABEB} = {15BED263-E56A-45B2-A647-7D44500383E1} - {3B8464A5-3795-464E-A3B2-D2851C9E38DC} = {15BED263-E56A-45B2-A647-7D44500383E1} {39DDC514-44CD-43BE-9E5B-C3B86665895E} = {13C213E0-722A-4CD5-9209-21E12FDA0CA8} {52C452EC-7C53-4177-A0C5-8CCFC6C0D76F} = {13C213E0-722A-4CD5-9209-21E12FDA0CA8} {B1629220-240B-4C02-80BE-655F093F86D8} = {13C213E0-722A-4CD5-9209-21E12FDA0CA8} diff --git a/src/Liquid.Adapter.AzureStorage/BlobClientFactory.cs b/src/Liquid.Adapter.AzureStorage/BlobClientFactory.cs index 51b58eb7..2248f8e6 100644 --- a/src/Liquid.Adapter.AzureStorage/BlobClientFactory.cs +++ b/src/Liquid.Adapter.AzureStorage/BlobClientFactory.cs @@ -24,21 +24,17 @@ public BlobClientFactory(IOptions? options) } /// - public List SetContainerClients() + public void SetContainerClients() { if(_options.Containers.Count == 0) - throw new ArgumentNullException(nameof(_options)); - - var clients = new List(); + throw new ArgumentNullException(nameof(_options)); foreach(var container in _options.Containers) { var client = new BlobContainerClient(container.ConnectionString,container.ContainerName); - clients.Add(client); + _clients.Add(client); } - - return clients; } /// diff --git a/src/Liquid.Adapter.AzureStorage/BlobStorageAdapter.cs b/src/Liquid.Adapter.AzureStorage/BlobStorageAdapter.cs index 19531a1a..5a3ff4cf 100644 --- a/src/Liquid.Adapter.AzureStorage/BlobStorageAdapter.cs +++ b/src/Liquid.Adapter.AzureStorage/BlobStorageAdapter.cs @@ -60,7 +60,7 @@ public async Task> GetAllBlobs(string containerName) var item = new LiquidBlob { - Blob = Encoding.UTF8.GetString(blob.Value.Content.ToArray()), + Blob = blob.Value.Content.ToArray(), Name = blobItem.Name }; results.Add(item); @@ -98,7 +98,7 @@ public async Task> ReadBlobsByTags(IDictionary var blob = await blockBlob.DownloadContentAsync(); var item = new LiquidBlob { - Blob = Encoding.UTF8.GetString(blob.Value.Content.ToArray()), + Blob = blob.Value.Content.ToArray(), Tags = blockBlob.GetTags().Value.Tags, Name = blobItem.BlobName }; @@ -108,7 +108,7 @@ public async Task> ReadBlobsByTags(IDictionary } /// - public async Task UploadBlob(string data, string name, string containerName, IDictionary? tags = null) + public async Task UploadBlob(byte[] data, string name, string containerName, IDictionary? tags = null) { var client = _factory.GetContainerClient(containerName); @@ -118,7 +118,7 @@ public async Task UploadBlob(string data, string name, string containerName, IDi { Tags = tags }; - await blockBlob.UploadAsync(new MemoryStream(Encoding.UTF8.GetBytes(data)), options); + await blockBlob.UploadAsync(new MemoryStream(data), options); } /// @@ -130,7 +130,7 @@ public async Task ReadBlobsByName(string blobName, string containerN var blob = await blockBlob.DownloadContentAsync(); var item = new LiquidBlob { - Blob = Encoding.UTF8.GetString(blob.Value.Content.ToArray()), + Blob = blob.Value.Content.ToArray(), Tags = blockBlob.GetTags().Value.Tags, Name = blobName }; diff --git a/src/Liquid.Adapter.AzureStorage/Extensions/IServiceCollectionExtensions.cs b/src/Liquid.Adapter.AzureStorage/Extensions/IServiceCollectionExtensions.cs index 0ed6723f..62f45afb 100644 --- a/src/Liquid.Adapter.AzureStorage/Extensions/IServiceCollectionExtensions.cs +++ b/src/Liquid.Adapter.AzureStorage/Extensions/IServiceCollectionExtensions.cs @@ -26,9 +26,9 @@ public static IServiceCollection AddLiquidAzureStorageAdapter(this IServiceColle configuration.GetSection(configSection).Bind(settings); }); - services.AddTransient(); + services.AddSingleton(); - services.AddSingleton(); + services.AddScoped(); return services; } diff --git a/src/Liquid.Adapter.AzureStorage/IBlobClientFactory.cs b/src/Liquid.Adapter.AzureStorage/IBlobClientFactory.cs index 6c977af2..08ca777f 100644 --- a/src/Liquid.Adapter.AzureStorage/IBlobClientFactory.cs +++ b/src/Liquid.Adapter.AzureStorage/IBlobClientFactory.cs @@ -17,7 +17,7 @@ public interface IBlobClientFactory /// for each container on the and /// add to . /// - List SetContainerClients(); + void SetContainerClients(); /// /// Get an instance of diff --git a/src/Liquid.Adapter.AzureStorage/ILiquidBlobStorageAdapter.cs b/src/Liquid.Adapter.AzureStorage/ILiquidBlobStorageAdapter.cs index a6fe25cf..80212fa4 100644 --- a/src/Liquid.Adapter.AzureStorage/ILiquidBlobStorageAdapter.cs +++ b/src/Liquid.Adapter.AzureStorage/ILiquidBlobStorageAdapter.cs @@ -14,7 +14,7 @@ public interface ILiquidBlobStorageAdapter /// Blob path. /// Blob container name. /// Blob list of tags. - Task UploadBlob(string data, string name, string containerName, IDictionary? tags = null); + Task UploadBlob(byte[] data, string name, string containerName, IDictionary? tags = null); /// /// Remove blob by id. diff --git a/src/Liquid.Adapter.AzureStorage/Liquid.Adapter.AzureStorage.csproj b/src/Liquid.Adapter.AzureStorage/Liquid.Adapter.AzureStorage.csproj index c3d8f88b..356a8e12 100644 --- a/src/Liquid.Adapter.AzureStorage/Liquid.Adapter.AzureStorage.csproj +++ b/src/Liquid.Adapter.AzureStorage/Liquid.Adapter.AzureStorage.csproj @@ -8,7 +8,7 @@ Avanade Inc. Liquid - Modern Application Framework Avanade 2019 - 6.0.0-preview-20221201-01 + 6.0.0-preview-20221201-02 true true diff --git a/src/Liquid.Adapter.AzureStorage/LiquidBlob.cs b/src/Liquid.Adapter.AzureStorage/LiquidBlob.cs index 84e5c0cc..7685d61f 100644 --- a/src/Liquid.Adapter.AzureStorage/LiquidBlob.cs +++ b/src/Liquid.Adapter.AzureStorage/LiquidBlob.cs @@ -16,7 +16,7 @@ public class LiquidBlob /// /// Conteúdo do blob. /// - public string? Blob { get; set; } + public byte[]? Blob { get; set; } /// /// Nome do arquivo no Storage. diff --git a/src/Liquid.WebApi.Http.Extensions.Crud/Liquid.WebApi.Http.Extensions.Crud.csproj b/src/Liquid.WebApi.Http.Extensions.Crud/Liquid.WebApi.Http.Extensions.Crud.csproj index c5f2d071..56173814 100644 --- a/src/Liquid.WebApi.Http.Extensions.Crud/Liquid.WebApi.Http.Extensions.Crud.csproj +++ b/src/Liquid.WebApi.Http.Extensions.Crud/Liquid.WebApi.Http.Extensions.Crud.csproj @@ -13,7 +13,7 @@ - netstandard2.1 + net6.0 Liquid.WebApi.Http.Extensions.Crud MIT Avanade Brazil @@ -22,7 +22,7 @@ Avanade 2019 https://github.com/Avanade/Liquid.WebApi logo.png - 6.0.0-preview-20230519-01 + 6.0.0-preview-20231130-01 true true Full diff --git a/src/Liquid.WebApi.Http/Liquid.WebApi.Http.csproj b/src/Liquid.WebApi.Http/Liquid.WebApi.Http.csproj index 1fc5b75f..ba0472df 100644 --- a/src/Liquid.WebApi.Http/Liquid.WebApi.Http.csproj +++ b/src/Liquid.WebApi.Http/Liquid.WebApi.Http.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net6.0 Liquid.WebApi.Http MIT Avanade Brazil @@ -10,7 +10,7 @@ Avanade 2019 https://github.com/Avanade/Liquid.WebApi logo.png - 6.0.0-preview-20230517-01 + 6.0.0-preview-20231130-01 true true Full diff --git a/src/Liquid.WebApi.Http/Settings/SwaggerSettings.cs b/src/Liquid.WebApi.Http/Settings/SwaggerSettings.cs index cb2ed119..17e0eaa1 100644 --- a/src/Liquid.WebApi.Http/Settings/SwaggerSettings.cs +++ b/src/Liquid.WebApi.Http/Settings/SwaggerSettings.cs @@ -1,5 +1,5 @@ using Liquid.Core.Attributes; -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System.Diagnostics.CodeAnalysis; namespace Liquid.WebApi.Http.Settings @@ -17,7 +17,7 @@ public class SwaggerSettings /// /// The name. /// - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } /// @@ -26,7 +26,7 @@ public class SwaggerSettings /// /// The host. /// - [JsonProperty("host")] + [JsonPropertyName("host")] public string Host { get; set; } /// @@ -35,7 +35,7 @@ public class SwaggerSettings /// /// Schemes. /// - [JsonProperty("schemes")] + [JsonPropertyName("schemes")] public string[] Schemes { get; set; } /// @@ -44,7 +44,7 @@ public class SwaggerSettings /// /// The title. /// - [JsonProperty("title")] + [JsonPropertyName("title")] public string Title { get; set; } /// @@ -53,7 +53,7 @@ public class SwaggerSettings /// /// The version. /// - [JsonProperty("version")] + [JsonPropertyName("version")] public string Version { get; set; } /// @@ -62,7 +62,7 @@ public class SwaggerSettings /// /// The description. /// - [JsonProperty("description")] + [JsonPropertyName("description")] public string Description { get; set; } /// @@ -71,7 +71,7 @@ public class SwaggerSettings /// /// The swagger endpoint. /// - [JsonProperty("endpoint")] + [JsonPropertyName("endpoint")] public SwaggerEndpoint SwaggerEndpoint { get; set; } } @@ -87,7 +87,7 @@ public class SwaggerEndpoint /// /// The URL. /// - [JsonProperty("url")] + [JsonPropertyName("url")] public string Url { get; set; } /// @@ -96,7 +96,7 @@ public class SwaggerEndpoint /// /// The name. /// - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } } } \ No newline at end of file