JonPSmith / AuthPermissions.AspNetCore

This library provides extra authorization and multi-tenant features to an ASP.NET Core application.
https://www.thereformedprogrammer.net/finally-a-library-that-improves-role-authorization-in-asp-net-core/
MIT License
770 stars 158 forks source link

Apply Migration based on Database Provider #4

Closed petrubocsanean closed 2 years ago

petrubocsanean commented 2 years ago

Hi @JonPSmith

I've added PostgreSQL database provider in my fork however I had to delete the migrations classes from the DataLayer folder, change the DB provider in DesignTimeContextFactory class and generate new ones. I was wondering on how to do this dynamically. I was thinking to generate migrations for PostgreSQL under a different folder and in SetupExtensions class apply them based on the database provider. For ex in UsingEfCoreSqlServer() apply the migration generated for SqlServer. Is that possible? Or how would you apply the migration based on the database provider?

Thanks!

JonPSmith commented 2 years ago

Hi @petrubocsanean,

I'm planning to do this in version 2 so I have thought about it. Its a bit complex and there are steps I haven't checked out yet, but I know that you need a two projects, one for the SQL Server migrations and one for PostgreSQL. Have a look at an EF Core standup on migrations - that has some useful information on this.

PS. Be aware I am about to release a new version which has a built-in adapter to get AuthP to work with Azure Active Directory. This has a quite a few changes in it and I have merged those changes into main, but I haven't created a new NuGet until the docs are up to date. Be aware, this might cause some merge problems if you have changed things.