diff --git a/src/MediatR.CommandQuery/Queries/EntityQuery.cs b/src/MediatR.CommandQuery/Queries/EntityQuery.cs index 2bf40721..3c82f2b2 100644 --- a/src/MediatR.CommandQuery/Queries/EntityQuery.cs +++ b/src/MediatR.CommandQuery/Queries/EntityQuery.cs @@ -17,17 +17,17 @@ public EntityQuery(string? query, int page, int pageSize, string? sort) PageSize = pageSize; } - public EntityQuery(EntityFilter filter, int page = 1, int pageSize = 20) + public EntityQuery(EntityFilter? filter, int page = 1, int pageSize = 20) : this(filter, Enumerable.Empty(), page, pageSize) { } - public EntityQuery(EntityFilter filter, EntitySort sort, int page = 1, int pageSize = 20) - : this(filter, new[] { sort }, page, pageSize) + public EntityQuery(EntityFilter? filter, EntitySort? sort, int page = 1, int pageSize = 20) + : this(filter, (sort != null) ? [sort] : null, page, pageSize) { } - public EntityQuery(EntityFilter filter, IEnumerable sort, int page = 1, int pageSize = 20) + public EntityQuery(EntityFilter? filter, IEnumerable? sort, int page = 1, int pageSize = 20) : base(filter, sort) { Page = page; diff --git a/src/MediatR.CommandQuery/Queries/EntitySelect.cs b/src/MediatR.CommandQuery/Queries/EntitySelect.cs index 29659463..5c3cb557 100644 --- a/src/MediatR.CommandQuery/Queries/EntitySelect.cs +++ b/src/MediatR.CommandQuery/Queries/EntitySelect.cs @@ -20,20 +20,20 @@ public EntitySelect(string? query, string? sort) Sort = new List { entitySort }; } - public EntitySelect(EntityFilter filter) + public EntitySelect(EntityFilter? filter) { Filter = filter; } - public EntitySelect(EntityFilter filter, EntitySort sort) + public EntitySelect(EntityFilter? filter, EntitySort? sort) { Filter = filter; if (sort != null) - Sort = new List { sort }; + Sort = [sort]; } - public EntitySelect(EntityFilter filter, IEnumerable sort) + public EntitySelect(EntityFilter? filter, IEnumerable? sort) { Filter = filter; Sort = sort?.ToList();