Skip to content

Commit

Permalink
Merge branch 'dev' into bugfix/event-subscribers-not-specific
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMWebb committed Jul 24, 2024
2 parents 107a5e1 + 5f8a667 commit df8a5b8
Show file tree
Hide file tree
Showing 34 changed files with 280 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected override void OnBuildInitialized()
{
Log.Information("Generating NuGet packages for projects in solution");
int commitNum = 0;
string NuGetVersionCustom = "2.0.0.883";
string NuGetVersionCustom = "2.0.0.884";


//if it's not a tagged release - append the commit number to the package version
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at hey@reactor2.com. All
reported by contacting the project team at rcommonteam@outlook.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Bogus" Version="35.5.1" />
<PackageReference Include="Bogus" Version="35.6.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\RCommon.ApplicationServices\RCommon.ApplicationServices.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

<ItemGroup>
<PackageReference Include="LocalStorage" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.7" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.4.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Src/RCommon.Core/Extensions/IQueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ private static MethodInfo GetLikeMethod(string value, char wildcard)
return stringType.GetMethod(methodName, new Type[] { stringType });
}

public static IPaginatedList<T> ToPaginatedList<T>(this IQueryable<T> source, int? pageIndex, int pageSize)
public static IPaginatedList<T> ToPaginatedList<T>(this IQueryable<T> source, int pageNumber = 1, int pageSize = 10)
{
Guard.IsNotNegativeOrZero(pageSize, "pageSize");

return new PaginatedList<T>(source, pageIndex, pageSize);
return new PaginatedList<T>(source, pageNumber, pageSize);
}

}
Expand Down
2 changes: 1 addition & 1 deletion Src/RCommon.Core/IPagedSpecification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RCommon
{
public interface IPagedSpecification<T> : ISpecification<T>
{
public int PageIndex { get; }
public int PageNumber { get; }
public int PageSize { get; }

public Expression<Func<T, object>> OrderByExpression { get; }
Expand Down
6 changes: 3 additions & 3 deletions Src/RCommon.Core/PagedSpecification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ namespace RCommon
public class PagedSpecification<T> : Specification<T>, IPagedSpecification<T>
{
public PagedSpecification(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByExpression,
bool orderByAscending, int pageIndex, int pageSize) : base(predicate)
bool orderByAscending, int pageNumber, int pageSize) : base(predicate)
{
OrderByExpression = orderByExpression;
OrderByAscending = orderByAscending;
PageIndex = pageIndex;
PageNumber = pageNumber;
PageSize = pageSize;
}

public Expression<Func<T, object>> OrderByExpression { get; }
public int PageIndex { get; }
public int PageNumber { get; }
public int PageSize { get; }

public bool OrderByAscending { get; set; }
Expand Down
6 changes: 3 additions & 3 deletions Src/RCommon.Core/RCommon.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@


<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
<PackageReference Include="Nito.AsyncEx.Context" Version="5.1.2" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Nito.AsyncEx.Context" Version="5.1.2" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
Expand Down
6 changes: 3 additions & 3 deletions Src/RCommon.Dapper/RCommon.Dapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Dapper.FluentMap.Dommel" Version="2.0.0" />
<PackageReference Include="Dommel" Version="3.3.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Dapper.FluentMap.Dommel" Version="2.0.0" />
<PackageReference Include="Dommel" Version="3.3.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Dapper.FluentMap.Dommel" Version="2.0.0" />
<PackageReference Include="Dommel" Version="3.3.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
</ItemGroup>

Expand Down
26 changes: 23 additions & 3 deletions Src/RCommon.EfCore/Crud/EFCoreRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ public async override Task<IPaginatedList<TEntity>> FindAsync(IPagedSpecificatio
{
query = FindCore(specification.Predicate).OrderByDescending(specification.OrderByExpression);
}
return await Task.FromResult(query.ToPaginatedList(specification.PageIndex, specification.PageSize));
return await Task.FromResult(query.ToPaginatedList(specification.PageNumber, specification.PageSize));
}

public async override Task<IPaginatedList<TEntity>> FindAsync(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int? pageIndex, int pageSize = 1,
bool orderByAscending, int pageNumber = 1, int pageSize = 1,
CancellationToken token = default)
{
IQueryable<TEntity> query;
Expand All @@ -218,7 +218,27 @@ public async override Task<IPaginatedList<TEntity>> FindAsync(Expression<Func<TE
{
query = FindCore(expression).OrderByDescending(orderByExpression);
}
return await Task.FromResult(query.ToPaginatedList(pageIndex, pageSize));
return await Task.FromResult(query.ToPaginatedList(pageNumber, pageSize));
}
public override IQueryable<TEntity> FindQuery(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int pageNumber = 1, int pageSize = 0)
{
IQueryable<TEntity> query;
if (orderByAscending)
{
query = FindCore(expression).OrderBy(orderByExpression);
}
else
{
query = FindCore(expression).OrderByDescending(orderByExpression);
}
return query.Skip((pageNumber - 1) * pageSize).Take(pageSize);
}

public override IQueryable<TEntity> FindQuery(IPagedSpecification<TEntity> specification)
{
return this.FindQuery(specification.Predicate, specification.OrderByExpression,
specification.OrderByAscending, specification.PageNumber, specification.PageSize);
}

public override async Task<TEntity> FindSingleOrDefaultAsync(Expression<Func<TEntity, bool>> expression, CancellationToken token = default)
Expand Down
12 changes: 5 additions & 7 deletions Src/RCommon.EfCore/RCommon.EFCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.26" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.26" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.15" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.4" />
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Src/RCommon.FluentValidation/RCommon.FluentValidation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.9.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.1" />
<PackageReference Include="FluentValidation" Version="11.9.2" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
</ItemGroup>

<ItemGroup>
Expand Down
28 changes: 25 additions & 3 deletions Src/RCommon.Linq2Db/Crud/Linq2DbRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using RCommon;
using RCommon.Persistence.Crud;
using RCommon.Persistence.Transactions;
using LinqToDB.Linq;

namespace RCommon.Persistence.Linq2Db.Crud
{
Expand Down Expand Up @@ -184,11 +185,11 @@ public async override Task<IPaginatedList<TEntity>> FindAsync(IPagedSpecificatio
{
query = FindCore(specification.Predicate).OrderByDescending(specification.OrderByExpression);
}
return await Task.FromResult(query.ToPaginatedList(specification.PageIndex, specification.PageSize));
return await Task.FromResult(query.ToPaginatedList(specification.PageNumber, specification.PageSize));
}

public async override Task<IPaginatedList<TEntity>> FindAsync(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int? pageIndex, int pageSize = 1,
bool orderByAscending, int pageNumber = 1, int pageSize = 1,
CancellationToken token = default)
{
IQueryable<TEntity> query;
Expand All @@ -200,7 +201,28 @@ public async override Task<IPaginatedList<TEntity>> FindAsync(Expression<Func<TE
{
query = FindCore(expression).OrderByDescending(orderByExpression);
}
return await Task.FromResult(query.ToPaginatedList(pageIndex, pageSize));
return await Task.FromResult(query.ToPaginatedList(pageNumber, pageSize));
}

public override IQueryable<TEntity> FindQuery(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int pageNumber = 1, int pageSize = 0)
{
IQueryable<TEntity> query;
if (orderByAscending)
{
query = FindCore(expression).OrderBy(orderByExpression);
}
else
{
query = FindCore(expression).OrderByDescending(orderByExpression);
}
return query.Skip((pageNumber - 1) * pageSize).Take(pageSize);
}

public override IQueryable<TEntity> FindQuery(IPagedSpecification<TEntity> specification)
{
return this.FindQuery(specification.Predicate, specification.OrderByExpression,
specification.OrderByAscending, specification.PageNumber, specification.PageSize);
}

public async override Task<TEntity> FindSingleOrDefaultAsync(Expression<Func<TEntity, bool>> expression, CancellationToken token = default)
Expand Down
2 changes: 1 addition & 1 deletion Src/RCommon.MassTransit/RCommon.MassTransit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MassTransit" Version="8.2.2" />
<PackageReference Include="MassTransit" Version="8.2.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Src/RCommon.Mediator/Subscribers/IAppRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface IAppRequest

}

public interface IAppRequest<TResponse>
public interface IAppRequest<out TResponse>
{

}
Expand Down
2 changes: 1 addition & 1 deletion Src/RCommon.Mediatr/RCommon.MediatR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="MediatR" Version="12.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion Src/RCommon.Persistence/Crud/ILinqRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ public interface ILinqRepository<TEntity>: IQueryable<TEntity>, IReadOnlyReposit
{
IQueryable<TEntity> FindQuery(ISpecification<TEntity> specification);
IQueryable<TEntity> FindQuery(Expression<Func<TEntity, bool>> expression);
IQueryable<TEntity> FindQuery(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int pageNumber = 1, int pageSize = 0);
IQueryable<TEntity> FindQuery(IPagedSpecification<TEntity> specification);

Task<IPaginatedList<TEntity>> FindAsync(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int? pageIndex, int pageSize = 0,
bool orderByAscending, int pageNumber = 1, int pageSize = 0,
CancellationToken token = default);
Task<IPaginatedList<TEntity>> FindAsync(IPagedSpecification<TEntity> specification, CancellationToken token = default);

Expand Down
6 changes: 5 additions & 1 deletion Src/RCommon.Persistence/Crud/LinqRepositoryBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,14 @@ public IEnumerable<TEntity> Query(ISpecification<TEntity> specification)
public abstract Task<bool> AnyAsync(ISpecification<TEntity> specification, CancellationToken token = default);

public abstract Task<IPaginatedList<TEntity>> FindAsync(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int? pageIndex, int pageSize = 0,
bool orderByAscending, int pageNumber = 1, int pageSize = 0,
CancellationToken token = default);
public abstract Task<IPaginatedList<TEntity>> FindAsync(IPagedSpecification<TEntity> specification, CancellationToken token = default);

public abstract IQueryable<TEntity> FindQuery(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, object>> orderByExpression,
bool orderByAscending, int pageNumber = 1, int pageSize = 0);
public abstract IQueryable<TEntity> FindQuery(IPagedSpecification<TEntity> specification);

public abstract IEagerLoadableQueryable<TEntity> Include(Expression<Func<TEntity, object>> path);

public abstract IEagerLoadableQueryable<TEntity> ThenInclude<TPreviousProperty, TProperty>(Expression<Func<object, TProperty>> path);
Expand Down
2 changes: 1 addition & 1 deletion Src/RCommon.Web/RCommon.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;</TargetFrameworks>
</PropertyGroup> <ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.4.1" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Src/RCommon.Wolverine/RCommon.Wolverine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="WolverineFx" Version="2.6.1" />
<PackageReference Include="WolverineFx" Version="2.15.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit df8a5b8

Please sign in to comment.