Skip to content

Commit e06d485

Browse files
committed
refactoring
1 parent c0d5555 commit e06d485

File tree

51 files changed

+993
-1037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+993
-1037
lines changed

.github/workflows/dotnet.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,7 @@ jobs:
3636

3737
- name: Collect Code Coverage
3838
run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=ManagedCode.Storage.Tests/lcov.info
39-
40-
# - name: test-reports
41-
# uses: dorny/test-reporter@v1.5.0
42-
# with:
43-
# name: Test Reporter
44-
# reporter: dotnet-trx
45-
# path: ManagedCode.Storage.Tests/test-results.trx
39+
4640

4741
- name: NDepend
4842
uses: ndepend/ndepend-action@v1
@@ -51,6 +45,7 @@ jobs:
5145
license: ${{ secrets.NDEPENDLICENSE }}
5246
coveragefolder: ManagedCode.Storage.Tests
5347
baseline: recent
48+
#baseline: main_recent
5449

5550
- name : coverlet
5651
uses: b3b00/coverlet-action@1.1.9

ManagedCode.Storage.Aws/AWSStorage.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override async Task<Result> RemoveContainerAsync(CancellationToken cancel
3434
}
3535
catch (Exception ex)
3636
{
37-
_logger?.LogError(ex.Message, ex);
37+
_logger.LogException(ex);
3838
return Result.Fail(ex);
3939
}
4040
}
@@ -104,7 +104,7 @@ protected override async Task<Result> CreateContainerInternalAsync(CancellationT
104104
}
105105
catch (Exception ex)
106106
{
107-
_logger?.LogError(ex.Message, ex);
107+
_logger.LogException(ex);
108108
return Result.Fail(ex);
109109
}
110110
}
@@ -124,7 +124,7 @@ protected override async Task<Result> DeleteDirectoryInternalAsync(string direct
124124
}
125125
catch (Exception ex)
126126
{
127-
_logger?.LogError(ex.Message, ex);
127+
_logger.LogException(ex);
128128
return Result.Fail(ex);
129129
}
130130
}
@@ -183,7 +183,7 @@ await localFile.CopyFromStreamAsync(await StorageClient.GetObjectStreamAsync(Sto
183183
}
184184
catch (Exception ex)
185185
{
186-
_logger?.LogError(ex.Message, ex);
186+
_logger.LogException(ex);
187187
return Result<LocalFile>.Fail(ex);
188188
}
189189
}
@@ -211,7 +211,7 @@ await StorageClient.DeleteObjectAsync(new DeleteObjectRequest
211211
}
212212
catch (Exception ex)
213213
{
214-
_logger?.LogError(ex.Message, ex);
214+
_logger.LogException(ex);
215215
return Result<bool>.Fail(ex);
216216
}
217217
}
@@ -235,7 +235,7 @@ protected override async Task<Result<bool>> ExistsInternalAsync(ExistOptions opt
235235
}
236236
catch (Exception ex)
237237
{
238-
_logger?.LogError(ex.Message, ex);
238+
_logger.LogException(ex);
239239
return Result<bool>.Fail(ex);
240240
}
241241
}
@@ -269,7 +269,7 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
269269
}
270270
catch (Exception ex)
271271
{
272-
_logger?.LogError(ex.Message, ex);
272+
_logger.LogException(ex);
273273
return Result<BlobMetadata>.Fail(ex);
274274
}
275275
}
@@ -301,7 +301,7 @@ protected override async Task<Result> SetLegalHoldInternalAsync(bool hasLegalHol
301301
}
302302
catch (Exception ex)
303303
{
304-
_logger?.LogError(ex.Message, ex);
304+
_logger.LogException(ex);
305305
return Result.Fail(ex);
306306
}
307307
}
@@ -323,7 +323,7 @@ protected override async Task<Result<bool>> HasLegalHoldInternalAsync(LegalHoldO
323323
}
324324
catch (Exception ex)
325325
{
326-
_logger?.LogError(ex.Message, ex);
326+
_logger.LogException(ex);
327327
return Result<bool>.Fail(ex);
328328
}
329329
}

ManagedCode.Storage.AzureDataLake/AzureDataLakeStorage.cs renamed to ManagedCode.Storage.Azure.DataLake/AzureDataLakeStorage.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
using Azure.Storage.Files.DataLake.Models;
1010
using ManagedCode.Communication;
1111
using ManagedCode.Communication.Extensions;
12-
using ManagedCode.Storage.AzureDataLake.Options;
12+
using ManagedCode.Storage.Azure.DataLake.Options;
1313
using ManagedCode.Storage.Core;
1414
using ManagedCode.Storage.Core.Models;
1515
using Microsoft.Extensions.Logging;
1616

17-
namespace ManagedCode.Storage.AzureDataLake;
17+
namespace ManagedCode.Storage.Azure.DataLake;
1818

1919
public class AzureDataLakeStorage : BaseStorage<DataLakeFileSystemClient, AzureDataLakeStorageOptions>, IAzureDataLakeStorage
2020
{
@@ -38,7 +38,7 @@ public override async Task<Result> RemoveContainerAsync(CancellationToken cancel
3838
}
3939
catch (Exception ex)
4040
{
41-
_logger?.LogError(ex.Message, ex);
41+
_logger.LogException(ex);
4242
return Result.Fail(ex);
4343
}
4444
}
@@ -54,7 +54,7 @@ public async Task<Result<Stream>> OpenReadStreamAsync(OpenReadStreamOptions opti
5454
}
5555
catch (Exception ex)
5656
{
57-
_logger?.LogError(ex.Message, ex);
57+
_logger.LogException(ex);
5858
return Result<Stream>.Fail(ex);
5959
}
6060
}
@@ -70,7 +70,7 @@ public async Task<Result<Stream>> OpenWriteStreamAsync(OpenWriteStreamOptions op
7070
}
7171
catch (Exception ex)
7272
{
73-
_logger?.LogError(ex.Message, ex);
73+
_logger.LogException(ex);
7474
return Result<Stream>.Fail(ex);
7575
}
7676
}
@@ -130,7 +130,7 @@ await _dataLakeServiceClient.CreateFileSystemAsync(StorageOptions.FileSystem, St
130130
}
131131
catch (Exception ex)
132132
{
133-
_logger?.LogError(ex.Message, ex);
133+
_logger.LogException(ex);
134134
return Result.Fail(ex);
135135
}
136136
}
@@ -156,7 +156,7 @@ protected override async Task<Result<BlobMetadata>> UploadInternalAsync(Stream s
156156
}
157157
catch (Exception ex)
158158
{
159-
_logger?.LogError(ex.Message, ex);
159+
_logger.LogException(ex);
160160
return Result<BlobMetadata>.Fail(ex);
161161
}
162162
}
@@ -187,7 +187,7 @@ protected override async Task<Result<LocalFile>> DownloadInternalAsync(LocalFile
187187
}
188188
catch (Exception ex)
189189
{
190-
_logger?.LogError(ex.Message, ex);
190+
_logger.LogException(ex);
191191
return Result<LocalFile>.Fail(ex);
192192
}
193193
}
@@ -202,7 +202,7 @@ protected override async Task<Result<bool>> DeleteInternalAsync(DeleteOptions op
202202
}
203203
catch (Exception ex)
204204
{
205-
_logger?.LogError(ex.Message, ex);
205+
_logger.LogException(ex);
206206
return Result<bool>.Fail(ex);
207207
}
208208
}
@@ -217,7 +217,7 @@ protected override async Task<Result<bool>> ExistsInternalAsync(ExistOptions opt
217217
}
218218
catch (Exception ex)
219219
{
220-
_logger?.LogError(ex.Message, ex);
220+
_logger.LogException(ex);
221221
return Result<bool>.Fail(ex);
222222
}
223223
}
@@ -246,7 +246,7 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
246246
}
247247
catch (Exception ex)
248248
{
249-
_logger?.LogError(ex.Message, ex);
249+
_logger.LogException(ex);
250250
return Result<BlobMetadata>.Fail(ex);
251251
}
252252
}

ManagedCode.Storage.AzureDataLake/Extensions/ServiceCollectionExtensions.cs renamed to ManagedCode.Storage.Azure.DataLake/Extensions/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System;
2-
using ManagedCode.Storage.AzureDataLake.Options;
2+
using ManagedCode.Storage.Azure.DataLake.Options;
33
using ManagedCode.Storage.Core;
44
using ManagedCode.Storage.Core.Exceptions;
55
using Microsoft.Extensions.DependencyInjection;
66

7-
namespace ManagedCode.Storage.AzureDataLake.Extensions;
7+
namespace ManagedCode.Storage.Azure.DataLake.Extensions;
88

99
public static class ServiceCollectionExtensions
1010
{

ManagedCode.Storage.AzureDataLake/IAzureDataLakeStorage.cs renamed to ManagedCode.Storage.Azure.DataLake/IAzureDataLakeStorage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
using System.Threading.Tasks;
44
using Azure.Storage.Files.DataLake;
55
using ManagedCode.Communication;
6-
using ManagedCode.Storage.AzureDataLake.Options;
6+
using ManagedCode.Storage.Azure.DataLake.Options;
77
using ManagedCode.Storage.Core;
88

9-
namespace ManagedCode.Storage.AzureDataLake;
9+
namespace ManagedCode.Storage.Azure.DataLake;
1010

1111
public interface IAzureDataLakeStorage : IStorage<DataLakeFileSystemClient, AzureDataLakeStorageOptions>
1212
{

ManagedCode.Storage.AzureDataLake/ManagedCode.Storage.AzureDataLake.csproj renamed to ManagedCode.Storage.Azure.DataLake/ManagedCode.Storage.Azure.DataLake.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<!--NuGet-->
1313
<PropertyGroup>
1414
<Title>ManagedCode.Storage.AzureDataLake</Title>
15-
<PackageId>ManagedCode.Storage.AzureDataLake</PackageId>
15+
<PackageId>ManagedCode.Storage.Azure.DataLake</PackageId>
1616
<Description>Storage for AzureDataLake</Description>
1717
<PackageTags>managedcode, azure, storage, cloud, blob, datalake, data, lake</PackageTags>
1818
</PropertyGroup>

ManagedCode.Storage.AzureDataLake/Options/AzureDataLakeStorageOptions.cs renamed to ManagedCode.Storage.Azure.DataLake/Options/AzureDataLakeStorageOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Azure.Storage.Files.DataLake.Models;
22
using ManagedCode.Storage.Core;
33

4-
namespace ManagedCode.Storage.AzureDataLake.Options;
4+
namespace ManagedCode.Storage.Azure.DataLake.Options;
55

66
public class AzureDataLakeStorageOptions : IStorageOptions
77
{
@@ -12,6 +12,6 @@ public class AzureDataLakeStorageOptions : IStorageOptions
1212

1313
public DataLakeFileSystemCreateOptions PublicAccessType { get; set; } = new()
1414
{
15-
PublicAccessType = Azure.Storage.Files.DataLake.Models.PublicAccessType.None
15+
PublicAccessType = global::Azure.Storage.Files.DataLake.Models.PublicAccessType.None
1616
};
1717
}

ManagedCode.Storage.AzureDataLake/Options/OpenReadStreamOptions.cs renamed to ManagedCode.Storage.Azure.DataLake/Options/OpenReadStreamOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ManagedCode.Storage.Core.Models;
22

3-
namespace ManagedCode.Storage.AzureDataLake.Options;
3+
namespace ManagedCode.Storage.Azure.DataLake.Options;
44

55
public class OpenReadStreamOptions : BaseOptions
66
{

ManagedCode.Storage.AzureDataLake/Options/OpenWriteStreamOptions.cs renamed to ManagedCode.Storage.Azure.DataLake/Options/OpenWriteStreamOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ManagedCode.Storage.Core.Models;
22

3-
namespace ManagedCode.Storage.AzureDataLake.Options;
3+
namespace ManagedCode.Storage.Azure.DataLake.Options;
44

55
public class OpenWriteStreamOptions : BaseOptions
66
{

ManagedCode.Storage.Azure/AzureStorage.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override async Task<Result> RemoveContainerAsync(CancellationToken cancel
3838
}
3939
catch (Exception ex)
4040
{
41-
_logger?.LogError(ex.Message, ex);
41+
_logger.LogException(ex);
4242
return Result.Fail(ex);
4343
}
4444
}
@@ -83,7 +83,7 @@ public async Task<Result<Stream>> OpenReadStreamAsync(string fileName,
8383
}
8484
catch (Exception ex)
8585
{
86-
_logger?.LogError(ex.Message, ex);
86+
_logger.LogException(ex);
8787
return Result<Stream>.Fail(ex);
8888
}
8989
}
@@ -100,7 +100,7 @@ public async Task<Result<Stream>> OpenWriteStreamAsync(string fileName,
100100
}
101101
catch (Exception ex)
102102
{
103-
_logger?.LogError(ex.Message, ex);
103+
_logger.LogException(ex);
104104
return Result<Stream>.Fail(ex);
105105
}
106106
}
@@ -154,7 +154,7 @@ await StorageClient.SetAccessPolicyAsync(StorageOptions.PublicAccessType,
154154
catch (Exception ex)
155155
{
156156
IsContainerCreated = false;
157-
_logger?.LogError(ex.Message, ex);
157+
_logger.LogException(ex);
158158
return Result.Fail(ex);
159159
}
160160
}
@@ -176,7 +176,7 @@ protected override async Task<Result> DeleteDirectoryInternalAsync(string direct
176176
}
177177
catch (Exception ex)
178178
{
179-
_logger?.LogError(ex.Message, ex);
179+
_logger.LogException(ex);
180180
return Result.Fail(ex);
181181
}
182182
}
@@ -205,7 +205,7 @@ protected override async Task<Result<BlobMetadata>> UploadInternalAsync(Stream s
205205
}
206206
catch (Exception ex)
207207
{
208-
_logger?.LogError(ex.Message, ex);
208+
_logger.LogException(ex);
209209
return Result<BlobMetadata>.Fail(ex);
210210
}
211211
}
@@ -239,7 +239,7 @@ protected override async Task<Result<LocalFile>> DownloadInternalAsync(LocalFile
239239
}
240240
catch (Exception ex)
241241
{
242-
_logger?.LogError(ex.Message, ex);
242+
_logger.LogException(ex);
243243
return Result<LocalFile>.Fail(ex);
244244
}
245245
}
@@ -261,7 +261,7 @@ protected override async Task<Result<bool>> DeleteInternalAsync(DeleteOptions op
261261
}
262262
catch (Exception ex)
263263
{
264-
_logger?.LogError(ex.Message, ex);
264+
_logger.LogException(ex);
265265
return Result<bool>.Fail(ex);
266266
}
267267
}
@@ -278,7 +278,7 @@ protected override async Task<Result<bool>> ExistsInternalAsync(ExistOptions opt
278278
}
279279
catch (Exception ex)
280280
{
281-
_logger?.LogError(ex.Message, ex);
281+
_logger.LogException(ex);
282282
return Result<bool>.Fail(ex);
283283
}
284284
}
@@ -312,7 +312,7 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
312312
}
313313
catch (Exception ex)
314314
{
315-
_logger?.LogError(ex.Message, ex);
315+
_logger.LogException(ex);
316316
return Result<BlobMetadata>.Fail(ex);
317317
}
318318
}
@@ -331,7 +331,7 @@ protected override async Task<Result> SetLegalHoldInternalAsync(bool hasLegalHol
331331
}
332332
catch (Exception ex)
333333
{
334-
_logger?.LogError(ex.Message, ex);
334+
_logger.LogException(ex);
335335
return Result.Fail(ex);
336336
}
337337
}
@@ -348,7 +348,7 @@ protected override async Task<Result<bool>> HasLegalHoldInternalAsync(LegalHoldO
348348
}
349349
catch (Exception ex)
350350
{
351-
_logger?.LogError(ex.Message, ex);
351+
_logger.LogException(ex);
352352
return Result<bool>.Fail(ex);
353353
}
354354
}

0 commit comments

Comments
 (0)