Closed alex6dj closed 6 years ago
One thing I don't have migrations enabled yet, I just use it to create the db and populate it with some test data
GetPendingMigrations execute a query on __MigrationHistory and requires an opened connection. Does it work with other providers? Try to ask on StackOverflow for more info.
OK, maybe this is the problem. I´m actually not using migrations (yet) then __MigrationHistory don´t exist in my db. I will do some test and let you know. Is the first time I use this, before I use sql ce and it works out of the box, but is too slow, I prefer sqlite, but there are a lot of tweaks to make it work without troubles. And I soo new to code first...
Thanks, I will make some test and if this is the problem I will find another way to seed the db with new data.
Ok this was the problem. I´m still developing the data layer, when I start using migrations I will try. Thanks for your anwer and your time. By the way I now using your library to generate al tables in db from code first and it works as expected. Good job
I'm trying migrations with your library. It's working OK with your example:
But when I try to do this it fails:
_pendingMigrations = migrator.GetPendingMigrations().Any();
Fails with System.ObjectDisposedException on .GetPendingMigrations()| ObjectName | "SQLiteConnection" | Source | "System.Data.SQLite"
| StackTrace | " en System.Data.SQLite.SQLiteConnection.CheckDisposed()\r\n en System.Data.SQLite.SQLiteConnection.get_State()\r\n en System.Data.Entity.Internal.RepositoryBase.CreateConnection()\r\n en System.Data.Entity.Migrations.History.HistoryRepository.QueryExists(String contextKey)\r\n en System.Data.Entity.Migrations.History.HistoryRepository.Exists(String contextKey)\r\n en System.Data.Entity.Migrations.History.HistoryRepository.GetPendingMigrations(IEnumerable`1 localMigrations)\r\n en System.Data.Entity.Migrations.DbMigrator.GetPendingMigrations()\r\n en QApps.DataLayer.Context.ContextMigrationConfiguration..ctor() en D:\Projects\...\Context\UnitOfWork.cs:línea 91"
I'm trying to init the db with some test data, but if I use Seed directly it set the data every time the app is launched, so I'm trying to Seed only after an update.
I will try the same question on StackOverflow just in case, any help will be apreciated.