23 lines
759 B
C#
23 lines
759 B
C#
using Ardalis.Specification;
|
||
using DD.Persistence.Database.EntityAbstractions;
|
||
|
||
namespace DD.Persistence.Database.Specifications.ValuesItem;
|
||
|
||
/// <summary>
|
||
/// Спецификация "меньше" для значений IValuesItem в соответствии с индексацией
|
||
/// </summary>
|
||
/// <typeparam name="TEntity"></typeparam>
|
||
public class ValueLessSpecification<TEntity> : Specification<TEntity>
|
||
where TEntity : IValuesItem
|
||
{
|
||
public ValueLessSpecification(int index, string? value)
|
||
{
|
||
Query.Where(e => string.Compare(Convert.ToString(e.Values[index]), value) < 0);
|
||
}
|
||
|
||
public ValueLessSpecification(int index, double? value)
|
||
{
|
||
Query.Where(e => Convert.ToDouble(e.Values[index]) < value);
|
||
}
|
||
}
|