Skip to content

Commit ff2d72f

Browse files
authored
Updated projects, drop support for old TFMs. (#326)
* Updated projects, drop support for old TFMs. * Minor fix.
1 parent 27e8f5c commit ff2d72f

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

Specification.EntityFrameworkCore/src/Ardalis.Specification.EntityFrameworkCore/Ardalis.Specification.EntityFrameworkCore.csproj

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
4+
<TargetFramework>net6.0</TargetFramework>
55
<PackageId>Ardalis.Specification.EntityFrameworkCore</PackageId>
66
<Title>Ardalis.Specification.EntityFrameworkCore</Title>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -34,20 +34,8 @@
3434

3535
<ItemGroup>
3636
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
37-
</ItemGroup>
38-
39-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
40-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
41-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.6" />
42-
</ItemGroup>
43-
44-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
45-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.13" />
46-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.13" />
47-
</ItemGroup>
48-
49-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
50-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.18" />
37+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
38+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.6" />
5139
</ItemGroup>
5240

5341
<ItemGroup>

Specification.EntityFrameworkCore/src/Ardalis.Specification.EntityFrameworkCore/ContextFactoryRepositoryBaseOfT.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ public async Task<bool> AnyAsync(CancellationToken cancellationToken = default)
129129
return await dbContext.Set<TEntity>().AnyAsync(cancellationToken);
130130
}
131131

132+
/// <inheritdoc/>
133+
public IAsyncEnumerable<TEntity> AsAsyncEnumerable(ISpecification<TEntity> specification)
134+
{
135+
using var dbContext = this.dbContextFactory.CreateDbContext();
136+
return ApplySpecification(specification, dbContext).AsAsyncEnumerable();
137+
}
138+
132139
/// <inheritdoc/>
133140
public async Task<TEntity> AddAsync(TEntity entity, CancellationToken cancellationToken = default)
134141
{

Specification.EntityFrameworkCore/src/Ardalis.Specification.EntityFrameworkCore/RepositoryBaseOfT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public virtual async Task<bool> AnyAsync(CancellationToken cancellationToken = d
176176
/// <inheritdoc/>
177177
public virtual IAsyncEnumerable<T> AsAsyncEnumerable(ISpecification<T> specification)
178178
{
179-
return ApplySpecification(specification, true).AsAsyncEnumerable();
179+
return ApplySpecification(specification).AsAsyncEnumerable();
180180
}
181181

182182
/// <summary>

Specification/src/Ardalis.Specification/Ardalis.Specification.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
55
<PackageId>Ardalis.Specification</PackageId>
66
<Title>Ardalis.Specification</Title>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -33,7 +33,6 @@
3333
</PropertyGroup>
3434

3535
<ItemGroup>
36-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" />
3736
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
3837
</ItemGroup>
3938

Specification/src/Ardalis.Specification/IReadRepositoryBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public interface IReadRepositoryBase<T> where T : class
168168
Task<bool> AnyAsync(CancellationToken cancellationToken = default);
169169

170170

171-
#if !NETSTANDARD2_0
171+
#if NET6_0_OR_GREATER
172172
/// <summary>
173173
/// Finds all entities of <typeparamref name="T" />, that matches the encapsulated query logic of the
174174
/// <paramref name="specification"/>, from the database.

sample/Ardalis.SampleApp.Core/Ardalis.SampleApp.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

sample/Ardalis.SampleApp.Infrastructure/Data/CachedCustomerRepository.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public CachedRepository(IMemoryCache cache,
2929
.SetAbsoluteExpiration(relative: TimeSpan.FromSeconds(10));
3030
}
3131

32+
/// <inheritdoc/>
33+
public virtual IAsyncEnumerable<T> AsAsyncEnumerable(ISpecification<T> specification)
34+
{
35+
return _sourceRepository.AsAsyncEnumerable(specification);
36+
}
37+
3238
/// <inheritdoc/>
3339
public Task<bool> AnyAsync(Specification.ISpecification<T> specification, CancellationToken cancellationToken = default)
3440
{

0 commit comments

Comments
 (0)