C#C
C#3y ago
altyn

Issues with EFCore

Hello everyone, I am trying to use ApplyConfigurationsFromAssembly but it seems to not be finding any configurations

        modelBuilder.ApplyConfigurationsFromAssembly(typeof(UserConfiguration).Assembly);


Instead, I have to apply configurations like this
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        // Call the base OnModelCreating
        base.OnModelCreating(modelBuilder);
        
        new PermissionConfiguration().Configure(modelBuilder.Entity<Permission>());
        new RoleConfiguration().Configure(modelBuilder.Entity<Role>());
        new UserConfiguration().Configure(modelBuilder.Entity<User>());
    }


and to apply them in correct order or migrations won't work, I am not sure what could be causing this issue, I have a clean architecture solution split into multiple projects. Could anyone point me to the right direction?
Was this page helpful?