Skip to content

Commit

Permalink
Simplified the page generic constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuck committed Dec 14, 2020
1 parent 5048bce commit 7a4de67
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/YuckQi.Domain.Services/Abstract/ITypeEntityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace YuckQi.Domain.Services.Abstract
{
public interface ITypeEntityService<T, TKey> where T : TypeEntityBase<TKey> where TKey : struct
public interface ITypeEntityService<T, in TKey> where T : TypeEntityBase<TKey> where TKey : struct
{
Task<Result<T>> CreateAsync(T entity);
Task<Result<T>> GetAsync(TKey key);
Task<Result<T>> ModifyAsync(T entity);
Task<Result<Page<T, TKey>>> SearchAsync(TypeSearchCriteria criteria = null);
Task<Result<Page<T>>> SearchAsync(TypeSearchCriteria criteria = null);
}
}
2 changes: 1 addition & 1 deletion src/YuckQi.Domain.Services/YuckQi.Domain.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>0.3.0</Version>
<Version>0.3.1</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>0.3.0</Version>
<Version>0.3.1</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

Expand Down
9 changes: 4 additions & 5 deletions src/YuckQi.Domain/Application/Queries/Results/Page.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using YuckQi.Domain.Application.Abstract;
using YuckQi.Domain.Entities.Abstract;

namespace YuckQi.Domain.Application.Queries.Results
{
Expand All @@ -25,21 +24,21 @@ public Page(int number, int size)
#endregion
}

public class Page<TEntity, TKey> : Page where TEntity : class, IEntity<TKey> where TKey : struct
public class Page<T> : Page where T : class
{
#region Properties

public IReadOnlyCollection<TEntity> Items { get; }
public IReadOnlyCollection<T> Items { get; }
public int TotalCount { get; }

#endregion


#region Constructors

public Page(IReadOnlyCollection<TEntity> items, int total, int number, int size) : base(number, size)
public Page(IReadOnlyCollection<T> items, int total, int number, int size) : base(number, size)
{
Items = items ?? new List<TEntity>();
Items = items ?? new List<T>();
TotalCount = total;
}

Expand Down
2 changes: 1 addition & 1 deletion src/YuckQi.Domain/YuckQi.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>0.3.0</Version>
<Version>0.3.1</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

Expand Down

0 comments on commit 7a4de67

Please sign in to comment.