Dbcontext umbenannt. DIExtention für modelBuilder hinzugefügt, um OnModelCreating zu verwenden.
This commit is contained in:
@@ -1,39 +1,35 @@
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class DDECMDbContext : DbContext
|
||||
{
|
||||
public DDECMDbContext(DbContextOptions<DDECMDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<User>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_INS"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD_LOG"));
|
||||
|
||||
modelBuilder.Entity<GroupOfUser>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<Group>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_AFT_UPD"))
|
||||
.HasKey(group => group.Guid);
|
||||
|
||||
modelBuilder.Entity<Module>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_MODULE_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<ModuleOfUser>();
|
||||
|
||||
modelBuilder.Entity<UserRep>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_REPRESENTATION_AFT_UPD"));
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure
|
||||
{
|
||||
public static class DbContextExtensions
|
||||
{
|
||||
public static ModelBuilder ConfigureUserManager(this ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<User>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_INS"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD_LOG"));
|
||||
|
||||
modelBuilder.Entity<GroupOfUser>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<Group>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_AFT_UPD"))
|
||||
.HasKey(group => group.Guid);
|
||||
|
||||
modelBuilder.Entity<Module>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_MODULE_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<ModuleOfUser>();
|
||||
|
||||
modelBuilder.Entity<UserRep>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_REPRESENTATION_AFT_UPD"));
|
||||
|
||||
return modelBuilder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,9 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class GroupOfUserRepository : CRUDRepository<GroupOfUser, int, DDECMDbContext>, IGroupOfUserRepository
|
||||
public class GroupOfUserRepository : CRUDRepository<GroupOfUser, int, UserManagerDbContext>, IGroupOfUserRepository
|
||||
{
|
||||
public GroupOfUserRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public GroupOfUserRepository(UserManagerDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class GroupRepository : CRUDRepository<Group, int, DDECMDbContext>, IGroupRepository
|
||||
public class GroupRepository : CRUDRepository<Group, int, UserManagerDbContext>, IGroupRepository
|
||||
{
|
||||
public GroupRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public GroupRepository(UserManagerDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class ModuleOfUserRepository : CRUDRepository<ModuleOfUser, int, DDECMDbContext>, IModuleOfUserRepository
|
||||
public class ModuleOfUserRepository : CRUDRepository<ModuleOfUser, int, UserManagerDbContext>, IModuleOfUserRepository
|
||||
{
|
||||
public ModuleOfUserRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public ModuleOfUserRepository(UserManagerDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class ModuleRepository : CRUDRepository<Module, int, DDECMDbContext>, IModuleRepository
|
||||
public class ModuleRepository : CRUDRepository<Module, int, UserManagerDbContext>, IModuleRepository
|
||||
{
|
||||
public ModuleRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public ModuleRepository(UserManagerDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserRepRepository : CRUDRepository<UserRep, int, DDECMDbContext>, IUserRepRepository
|
||||
public class UserRepRepository : CRUDRepository<UserRep, int, UserManagerDbContext>, IUserRepRepository
|
||||
{
|
||||
public UserRepRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public UserRepRepository(UserManagerDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserRepository : CRUDRepository<User, int, DDECMDbContext>, IUserRepository
|
||||
public class UserRepository : CRUDRepository<User, int, UserManagerDbContext>, IUserRepository
|
||||
{
|
||||
private IModuleOfUserRepository _moduleOfUserRepo;
|
||||
private IGroupOfUserRepository _groupOfUserRepo;
|
||||
public UserRepository(DDECMDbContext dbContext, IModuleOfUserRepository moduleOfUserRepo, IGroupOfUserRepository groupOfUserRepo) : base(dbContext)
|
||||
public UserRepository(UserManagerDbContext dbContext, IModuleOfUserRepository moduleOfUserRepo, IGroupOfUserRepository groupOfUserRepo) : base(dbContext)
|
||||
{
|
||||
_moduleOfUserRepo = moduleOfUserRepo;
|
||||
_groupOfUserRepo = groupOfUserRepo;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserManagerDbContext : DbContext
|
||||
{
|
||||
public UserManagerDbContext(DbContextOptions<UserManagerDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ConfigureUserManager();
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user