Skip to content

Commit cbffb99

Browse files
committed
net7.0
1 parent 00a13af commit cbffb99

File tree

20 files changed

+76
-76
lines changed

20 files changed

+76
-76
lines changed

DistributedFileStorage.EntityFrameworkCore/DfsDatabase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public async Task<DfsDbItem<TMetadata>> Delete(string id, CancellationToken canc
8585

8686
if (!await _context.DfsFileInfo.AnyAsync(x => x.ContentId == entity.ContentId, cancellationToken))
8787
{
88-
_context.Remove(entity.Content);
88+
_context.Remove(entity.Content!);
8989
await _context.SaveChangesAsync(cancellationToken);
9090
}
9191

@@ -105,7 +105,7 @@ private DfsDbItem<TMetadata> Map(DfsDbFileInfo entity)
105105
};
106106
}
107107

108-
private async Task WithRetry(int retries, Func<int, Task> task)
108+
private static async Task WithRetry(int retries, Func<int, Task> task)
109109
{
110110
for (var i = 0; i <= retries; i++)
111111
try

DistributedFileStorage.EntityFrameworkCore/DfsDbEntities.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal class DfsDbFileInfo
99
public DfsDbContentInfo? Content { get; set; }
1010

1111
public override int GetHashCode() => Id.GetHashCode();
12-
public override bool Equals(object obj) => Id == (obj as DfsDbFileInfo)?.Id;
12+
public override bool Equals(object? obj) => Id == (obj as DfsDbFileInfo)?.Id;
1313
}
1414

1515
internal class DfsDbContentInfo
@@ -19,6 +19,6 @@ internal class DfsDbContentInfo
1919
public long Length { get; set; }
2020

2121
public override int GetHashCode() => Id.GetHashCode();
22-
public override bool Equals(object obj) => Id == (obj as DfsDbContentInfo)?.Id;
22+
public override bool Equals(object? obj) => Id == (obj as DfsDbContentInfo)?.Id;
2323
}
2424
}
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.1;net6.0;net7.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<Nullable>enable</Nullable>
77
<SignAssembly>True</SignAssembly>
88
<AssemblyOriginatorKeyFile>..\DistributedFileStorage.snk</AssemblyOriginatorKeyFile>
9-
<AssemblyVersion>1.0.2</AssemblyVersion>
10-
<FileVersion>1.0.2</FileVersion>
11-
<Version>1.0.2</Version>
9+
<AssemblyVersion>1.0.3</AssemblyVersion>
10+
<FileVersion>1.0.3</FileVersion>
11+
<Version>1.0.3</Version>
1212
<Company></Company>
1313
<Authors>Leonid Salavatov</Authors>
14-
<Copyright>Leonid Salavatov 2021</Copyright>
14+
<Copyright>Leonid Salavatov 2022</Copyright>
1515
<PackageId>DistributedFileStorage.EntityFrameworkCore</PackageId>
1616
<Product>DistributedFileStorage.EntityFrameworkCore</Product>
1717
<Title>DistributedFileStorage.EntityFrameworkCore</Title>
1818
<Description>.NET DistributedFileStorage with EntityFrameworkCore</Description>
19-
<PackageTags>distributed filestorage blobstorage entityframework efcore blob dfs dotnet</PackageTags>
19+
<PackageTags>filestorage file-storage blobstorage blob-storage distributed-storage storage entityframework efcore blob dfs</PackageTags>
2020
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2121
<PackageProjectUrl>https://github.com/mustaddon/DistributedFileStorage</PackageProjectUrl>
2222
<RepositoryUrl>https://github.com/mustaddon/DistributedFileStorage</RepositoryUrl>
@@ -27,18 +27,20 @@
2727
<PackageReleaseNotes></PackageReleaseNotes>
2828
</PropertyGroup>
2929

30-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
31-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
32-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
30+
<ItemGroup>
31+
<ProjectReference Include="..\DistributedFileStorage\DistributedFileStorage.csproj" />
3332
</ItemGroup>
3433

35-
<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
36-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.12" />
34+
<ItemGroup>
3735
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
3836
</ItemGroup>
37+
38+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
39+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.17" />
40+
</ItemGroup>
3941

40-
<ItemGroup>
41-
<ProjectReference Include="..\DistributedFileStorage\DistributedFileStorage.csproj" />
42+
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'">
43+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
4244
</ItemGroup>
4345

4446
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# DistributedFileStorage.EntityFrameworkCore [![NuGet version](https://badge.fury.io/nu/DistributedFileStorage.EntityFrameworkCore.svg)](http://badge.fury.io/nu/DistributedFileStorage.EntityFrameworkCore)
2-
.NET DistributedFileStorage with EntityFrameworkCore implementation of IDfsDatabase
2+
DistributedFileStorage with EntityFrameworkCore implementation of IDfsDatabase
33

DistributedFileStorage.MongoDB/DfsDbEntities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ internal class DfsDbFileInfo<TMetadata>
1515
public string? Metadata { get; set; }
1616

1717
public override int GetHashCode() => Id.GetHashCode();
18-
public override bool Equals(object obj) => Id == (obj as DfsDbFileInfo<TMetadata>)?.Id;
18+
public override bool Equals(object? obj) => Id == (obj as DfsDbFileInfo<TMetadata>)?.Id;
1919
}
2020
}
Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.1;net6.0;net7.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<Nullable>enable</Nullable>
77
<SignAssembly>True</SignAssembly>
88
<AssemblyOriginatorKeyFile>..\DistributedFileStorage.snk</AssemblyOriginatorKeyFile>
9-
<AssemblyVersion>1.0.2</AssemblyVersion>
10-
<FileVersion>1.0.2</FileVersion>
11-
<Version>1.0.2</Version>
9+
<AssemblyVersion>1.0.3</AssemblyVersion>
10+
<FileVersion>1.0.3</FileVersion>
11+
<Version>1.0.3</Version>
1212
<Company></Company>
1313
<Authors>Leonid Salavatov</Authors>
14-
<Copyright>Leonid Salavatov 2021</Copyright>
14+
<Copyright>Leonid Salavatov 2022</Copyright>
1515
<PackageId>DistributedFileStorage.MongoDB</PackageId>
1616
<Product>DistributedFileStorage.MongoDB</Product>
1717
<Title>DistributedFileStorage.MongoDB</Title>
1818
<Description>.NET DistributedFileStorage with MongoDB</Description>
19-
<PackageTags>distributed filestorage blobstorage mongodb mongo blob dfs dotnet</PackageTags>
19+
<PackageTags>filestorage file-storage blobstorage blob-storage distributed-storage storage mongodb mongo blob dfs</PackageTags>
2020
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2121
<PackageProjectUrl>https://github.com/mustaddon/DistributedFileStorage</PackageProjectUrl>
2222
<RepositoryUrl>https://github.com/mustaddon/DistributedFileStorage</RepositoryUrl>
@@ -27,20 +27,14 @@
2727
<PackageReleaseNotes></PackageReleaseNotes>
2828
</PropertyGroup>
2929

30-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
31-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
32-
<PackageReference Include="MongoDB.Driver" Version="2.13.2" />
33-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
34-
</ItemGroup>
35-
36-
<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
37-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
38-
<PackageReference Include="MongoDB.Driver" Version="2.13.2" />
39-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
30+
<ItemGroup>
31+
<ProjectReference Include="..\DistributedFileStorage\DistributedFileStorage.csproj" />
4032
</ItemGroup>
4133

4234
<ItemGroup>
43-
<ProjectReference Include="..\DistributedFileStorage\DistributedFileStorage.csproj" />
35+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
36+
<PackageReference Include="MongoDB.Driver" Version="2.18.0" />
37+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
4438
</ItemGroup>
4539

4640
</Project>

DistributedFileStorage.MongoDB/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# DistributedFileStorage.MongoDB [![NuGet version](https://badge.fury.io/nu/DistributedFileStorage.MongoDB.svg)](http://badge.fury.io/nu/DistributedFileStorage.MongoDB)
2-
.NET DistributedFileStorage with MongoDB implementation of IDfsDatabase
2+
DistributedFileStorage with MongoDB implementation of IDfsDatabase
33

44

55
## Features

DistributedFileStorage.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
ProjectSection(SolutionItems) = preProject
1414
.gitignore = .gitignore
1515
LICENSE = LICENSE
16+
pack.ps1 = pack.ps1
1617
README.md = README.md
1718
EndProjectSection
1819
EndProject

DistributedFileStorage/DfsFileInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public DfsFileInfo(string id, string name, long length, TMetadata? metadata = de
1616
public TMetadata? Metadata { get; }
1717

1818
public override int GetHashCode() => Id.GetHashCode();
19-
public override bool Equals(object obj) => Id == (obj as DfsFileInfo<TMetadata>)?.Id;
19+
public override bool Equals(object? obj) => Id == (obj as DfsFileInfo<TMetadata>)?.Id;
2020
}
2121
}

DistributedFileStorage/DistributedFileStorage.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public async IAsyncEnumerable<byte[]> GetContent(string id, [EnumeratorCancellat
9191

9292

9393

94-
private async Task<(byte[] hash, long length)> SaveContent(IAsyncEnumerator<byte[]> content, string path, CancellationToken cancellationToken)
94+
private static async Task<(byte[] hash, long length)> SaveContent(IAsyncEnumerator<byte[]> content, string path, CancellationToken cancellationToken)
9595
{
96-
(new FileInfo(path)).Directory.Create();
96+
(new FileInfo(path)).Directory!.Create();
9797

9898
using var file = File.Create(path);
9999
using var sha = SHA256.Create();
@@ -108,8 +108,8 @@ public async IAsyncEnumerable<byte[]> GetContent(string id, [EnumeratorCancellat
108108
length += content.Current.Length;
109109
}
110110

111-
sha.TransformFinalBlock(new byte[0], 0, 0);
112-
return (sha.Hash, length);
111+
sha.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
112+
return (sha.Hash!, length);
113113
}
114114

115115
private async Task SaveInfo(DfsDbItem<TMetadata> item, CancellationToken cancellationToken)
@@ -136,7 +136,7 @@ private static string GetHashString(byte[] hash, long length)
136136
return Convert.ToBase64String(bytes, 0, bytes.Length - zeroes);
137137
}
138138

139-
private async IAsyncEnumerable<IEnumerable<T>> Batches<T>(IAsyncEnumerator<T> items, int size = 1000)
139+
private static async IAsyncEnumerable<IEnumerable<T>> Batches<T>(IAsyncEnumerator<T> items, int size = 1000)
140140
{
141141
var tmp = new List<T>();
142142

@@ -155,7 +155,7 @@ private async IAsyncEnumerable<IEnumerable<T>> Batches<T>(IAsyncEnumerator<T> it
155155
yield return tmp;
156156
}
157157

158-
private DfsFileInfo<TMetadata> Map(DfsDbItem<TMetadata> item)
158+
private static DfsFileInfo<TMetadata> Map(DfsDbItem<TMetadata> item)
159159
{
160160
return new DfsFileInfo<TMetadata>(item.Id, item.Name, item.Length, item.Metadata);
161161
}

0 commit comments

Comments
 (0)