Dbcontext umbenannt. DIExtention für modelBuilder hinzugefügt, um OnModelCreating zu verwenden.

This commit is contained in:
Developer 02
2024-06-13 13:29:55 +02:00
parent d2dc116cd0
commit 8faed31baa
10 changed files with 71 additions and 57 deletions

View File

@@ -0,0 +1,35 @@
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;
}
}
}