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

@@ -3,6 +3,7 @@ using DigitalData.UserManager.Application.MappingProfiles;
using DigitalData.UserManager.Application.Services;
using DigitalData.UserManager.Infrastructure.Contracts;
using DigitalData.UserManager.Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace DigitalData.UserManager.Application
@@ -17,7 +18,8 @@ namespace DigitalData.UserManager.Application
/// </remarks>
/// <param name="services">The IServiceCollection to add services to.</param>
/// <returns>The updated IServiceCollection.</returns>
public static IServiceCollection AddUserManager(this IServiceCollection services) => services
public static IServiceCollection AddUserManager(this IServiceCollection services, Action<DbContextOptionsBuilder>? optionsAction) => services
.AddDbContext<UserManagerDbContext>(optionsAction: optionsAction)
.AddAutoMapper(typeof(UserMappingProfile).Assembly)
.AddAutoMapper(typeof(GroupMappingProfile).Assembly)
.AddAutoMapper(typeof(GroupOfUserMappingProfile).Assembly)