feat(core): Core-Bibliotheken auf 2.0.0.0 aktualisiert und IUnique implementiert
- `IUnique`-Schnittstelle in allen Entitäten implementiert. - Interface für DbContext erstellt und DbSet-Eigenschaften in den Konstruktoren über Repositories injiziert.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
||||
{
|
||||
public interface IUserManagerDbContext
|
||||
{
|
||||
public DbSet<GroupOfUser> GroupOfUsers { get; }
|
||||
|
||||
public DbSet<Group> Groups { get; }
|
||||
|
||||
public DbSet<ModuleOfUser> ModuleOfUsers { get; }
|
||||
|
||||
public DbSet<Module> Modules { get; }
|
||||
|
||||
public DbSet<User> Users { get; }
|
||||
|
||||
public DbSet<UserRep> UserReps { get; }
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,4 @@ namespace DigitalData.UserManager.Infrastructure
|
||||
return modelBuilder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DigitalData.Core.Infrastructure" Version="1.0.1.1" />
|
||||
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -6,9 +6,9 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class GroupOfUserRepository<TDbContext> : CRUDRepository<GroupOfUser, int, TDbContext>, IGroupOfUserRepository
|
||||
where TDbContext : DbContext
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
public GroupOfUserRepository(TDbContext dbContext) : base(dbContext)
|
||||
public GroupOfUserRepository(TDbContext dbContext) : base(dbContext, dbContext.GroupOfUsers)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class GroupRepository<TDbContext> : CRUDRepository<Group, int, TDbContext>, IGroupRepository
|
||||
where TDbContext : DbContext
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
public GroupRepository(TDbContext dbContext) : base(dbContext)
|
||||
public GroupRepository(TDbContext dbContext) : base(dbContext, dbContext.Groups)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class ModuleOfUserRepository<TDbContext> : CRUDRepository<ModuleOfUser, int, TDbContext>, IModuleOfUserRepository
|
||||
where TDbContext : DbContext
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
public ModuleOfUserRepository(TDbContext dbContext) : base(dbContext)
|
||||
public ModuleOfUserRepository(TDbContext dbContext) : base(dbContext, dbContext.ModuleOfUsers)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class ModuleRepository<TDbContext> : CRUDRepository<Module, int, TDbContext>, IModuleRepository
|
||||
where TDbContext : DbContext
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
public ModuleRepository(TDbContext dbContext) : base(dbContext)
|
||||
public ModuleRepository(TDbContext dbContext) : base(dbContext, dbContext.Modules)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
||||
where TDbContext : DbContext
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
public UserRepRepository(TDbContext dbContext) : base(dbContext)
|
||||
public UserRepRepository(TDbContext dbContext) : base(dbContext, dbContext.UserReps)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserRepository<TDbContext> : CRUDRepository<User, int, TDbContext>, IUserRepository
|
||||
where TDbContext : DbContext
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
private IModuleOfUserRepository _moduleOfUserRepo;
|
||||
private IGroupOfUserRepository _groupOfUserRepo;
|
||||
public UserRepository(TDbContext dbContext, IModuleOfUserRepository moduleOfUserRepo, IGroupOfUserRepository groupOfUserRepo) : base(dbContext)
|
||||
public UserRepository(TDbContext dbContext, IModuleOfUserRepository moduleOfUserRepo, IGroupOfUserRepository groupOfUserRepo) : base(dbContext, dbContext.Users)
|
||||
{
|
||||
_moduleOfUserRepo = moduleOfUserRepo;
|
||||
_groupOfUserRepo = groupOfUserRepo;
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserManagerDbContext : DbContext
|
||||
public class UserManagerDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
public DbSet<GroupOfUser> GroupOfUsers { get; set; }
|
||||
|
||||
public DbSet<Group> Groups { get; set; }
|
||||
|
||||
public DbSet<ModuleOfUser> ModuleOfUsers { get; set; }
|
||||
|
||||
public DbSet<Module> Modules { get; set; }
|
||||
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
||||
public DbSet<UserRep> UserReps { get; set; }
|
||||
|
||||
public UserManagerDbContext(DbContextOptions<UserManagerDbContext> options) : base(options)
|
||||
{
|
||||
GroupOfUsers = Set<GroupOfUser>();
|
||||
Groups = Set<Group>();
|
||||
ModuleOfUsers = Set<ModuleOfUser>();
|
||||
Modules = Set<Module>();
|
||||
Users = Set<User>();
|
||||
UserReps = Set<UserRep>();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
|
||||
Reference in New Issue
Block a user