removed devexpress and refactoring

This commit is contained in:
2020-07-27 21:23:28 +02:00
parent 31a39de724
commit acbc1a7d8f
16 changed files with 265 additions and 222 deletions

View File

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
@ -8,7 +10,7 @@ using UserService.DatabaseLayer.DataModels;
namespace UserService.DatabaseLayer.Repository
{
public class BaseRepository<T> where T : class
public class BaseRepository<T> where T : Node
{
private readonly Func<UserServiceDbContext, DbSet<T>> _context;
@ -20,7 +22,7 @@ namespace UserService.DatabaseLayer.Repository
public async Task<IReadOnlyList<T>> GetAllAsync(CancellationToken token = default)
{
await using var db = new UserServiceDbContext();
return await _context(db).ToListAsync(token);
return await _context(db).Include(x => x.Parent).ToListAsync(token);
}
public async Task<T?> GetAsync(Expression<Func<T, bool>> predicate, CancellationToken token = default)