feat: spec + repo
This commit is contained in:
parent
eff887b49f
commit
2206fe027a
78 changed files with 3870 additions and 0 deletions
38
src/request.persistence/_expressions/WhereExpressionInfo.cs
Normal file
38
src/request.persistence/_expressions/WhereExpressionInfo.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Geekeey.Request.Persistence;
|
||||
|
||||
/// <summary>
|
||||
/// Stores information about a where expression.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The entity type.</typeparam>
|
||||
public sealed class WhereExpressionInfo<T>
|
||||
{
|
||||
private readonly Lazy<Func<T, bool>> _filterFunc;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new where expression info.
|
||||
/// </summary>
|
||||
/// <param name="filter">The filter expression.</param>
|
||||
public WhereExpressionInfo(Expression<Func<T, bool>> filter)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(filter);
|
||||
|
||||
Filter = filter;
|
||||
|
||||
_filterFunc = new Lazy<Func<T, bool>>(Filter.Compile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the filter expression.
|
||||
/// </summary>
|
||||
public Expression<Func<T, bool>> Filter { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the compiled filter function.
|
||||
/// </summary>
|
||||
public Func<T, bool> FilterFunc => _filterFunc.Value;
|
||||
}
|
||||
Loading…
Reference in a new issue