.NET library to access data storage with Unit of Work, Repository and Entity classes
GodelTech.Data
project has interfaces for Unit of Work and Repository pattern.
Implementation of it for Entity Framework Core can be found in library GodelTech.Data.EntityFrameworkCore
You can find Repository extensions using QueryParameters
and ISpecification
that allows you create requests easier.
QueryParameters.cs
public class QueryParameters<TEntity, TKey>
where TEntity : class, IEntity<TKey>
{
public FilterRule<TEntity, TKey> Filter { get; set; }
public SortRule<TEntity, TKey> Sort { get; set; }
public PageRule Page { get; set; }
}
SpecificationBase.cs
public abstract class SpecificationBase<TEntity, TKey> : CompositeSpecification<TEntity, TKey>
where TEntity : class, IEntity<TKey>
{
public override bool IsSatisfiedBy(TEntity candidate) => AsExpression().Compile().Invoke(candidate);
public abstract Expression<Func<TEntity, bool>> AsExpression();
}