51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using Abp;
|
|
using Abp.Dependency;
|
|
using Abp.Domain.Repositories;
|
|
using Abp.Modules;
|
|
using BenchmarkDotNet.Attributes;
|
|
using SplashPage.EntityFrameworkCore;
|
|
using SplashPage.Splash;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
|
|
namespace SplashPage.Benchmarks
|
|
{
|
|
[MemoryDiagnoser]
|
|
[RankColumn]
|
|
public class RepositoryBenchmarks
|
|
{
|
|
private readonly IRepository<SplashWiFiScanningData> _repository;
|
|
|
|
[Benchmark]
|
|
public List<SplashWiFiScanningData> GetAllActiveItems()
|
|
{
|
|
return _repository.GetAll()
|
|
.Where(x => x.ManufacturerIsExcluded)
|
|
.ToList();
|
|
}
|
|
|
|
[Benchmark]
|
|
public List<SplashWiFiScanningData> GetPagedActiveItems()
|
|
{
|
|
return _repository.GetAll()
|
|
.Where(x => x.ManufacturerIsExcluded)
|
|
.OrderBy(x => x.Manufacturer)
|
|
.Skip(0)
|
|
.Take(50)
|
|
.ToList();
|
|
}
|
|
|
|
[Benchmark]
|
|
public async Task<List<SplashWiFiScanningData>> GetAllActiveItemsAsync()
|
|
{
|
|
return _repository.GetAll()
|
|
.Where(x => x.ManufacturerIsExcluded)
|
|
.ToList();
|
|
}
|
|
}
|
|
}
|