Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<PackageId>Ardalis.Specification.EntityFrameworkCore</PackageId>
<Title>Ardalis.Specification.EntityFrameworkCore</Title>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -34,20 +34,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.6" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.13" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.18" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.6" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ public async Task<bool> AnyAsync(CancellationToken cancellationToken = default)
return await dbContext.Set<TEntity>().AnyAsync(cancellationToken);
}

/// <inheritdoc/>
public IAsyncEnumerable<TEntity> AsAsyncEnumerable(ISpecification<TEntity> specification)
{
using var dbContext = this.dbContextFactory.CreateDbContext();
return ApplySpecification(specification, dbContext).AsAsyncEnumerable();
}

/// <inheritdoc/>
public async Task<TEntity> AddAsync(TEntity entity, CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public virtual async Task<bool> AnyAsync(CancellationToken cancellationToken = d
/// <inheritdoc/>
public virtual IAsyncEnumerable<T> AsAsyncEnumerable(ISpecification<T> specification)
{
return ApplySpecification(specification, true).AsAsyncEnumerable();
return ApplySpecification(specification).AsAsyncEnumerable();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<PackageId>Ardalis.Specification</PackageId>
<Title>Ardalis.Specification</Title>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -33,7 +33,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public interface IReadRepositoryBase<T> where T : class
Task<bool> AnyAsync(CancellationToken cancellationToken = default);


#if !NETSTANDARD2_0
#if NET6_0_OR_GREATER
/// <summary>
/// Finds all entities of <typeparamref name="T" />, that matches the encapsulated query logic of the
/// <paramref name="specification"/>, from the database.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public CachedRepository(IMemoryCache cache,
.SetAbsoluteExpiration(relative: TimeSpan.FromSeconds(10));
}

/// <inheritdoc/>
public virtual IAsyncEnumerable<T> AsAsyncEnumerable(ISpecification<T> specification)
{
return _sourceRepository.AsAsyncEnumerable(specification);
}

/// <inheritdoc/>
public Task<bool> AnyAsync(Specification.ISpecification<T> specification, CancellationToken cancellationToken = default)
{
Expand Down