Base solution for your next web application

Activities of "[email protected]"

Hi,

We are using the Zero framework for Single Tenancy and would like to eliminate the EF Migrator tool from our development and build pipeline.

Normally with EF Code First you should be able to use the MigrateDatabaseToLatestVersion initializer to create a new database, run migrations and then run the seed. However this does not seem to work with Zero.

We have added the following to the ZeroDbContext:

Database.SetInitializer(new MigrateDatabaseToLatestVersion<ZeroDbContext, Configuration>());

However when running the solution without an existing database the following error occurs :

"CREATE DATABASE statement not allowed within multi-statement transaction"

If we create an empty database manually first (not ideal, but acceptable) then the migrations appear to run but not the seed and we have the following error:

"There is no tenant with given id: 1"

This error is caused by the seed not executing.

Can you please advise how we can eliminate the need for the Migrator and have the migrations and seed run automatically.

Kind Regards.

Showing 21 to 21 of 21 entries