WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 4720779

Browse files
committed
Bug fix. DesignTimeDbContextFactoryBase used to call context.Database.Migrate() . Must now do so ourselves
1 parent 0c51216 commit 4720779

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/ApplicationServices/DbContexts.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ public static class DbContexts
1111
public static LibationContext GetContext()
1212
=> InstanceQueue<LibationContext>.WaitToCreateInstance(() =>
1313
{
14-
return !string.IsNullOrEmpty(Configuration.Instance.PostgresqlConnectionString)
14+
var context = !string.IsNullOrEmpty(Configuration.Instance.PostgresqlConnectionString)
1515
? LibationContextFactory.CreatePostgres(Configuration.Instance.PostgresqlConnectionString)
1616
: LibationContextFactory.CreateSqlite(SqliteStorage.ConnectionString);
17+
context.Database.Migrate();
18+
return context;
1719
});
1820

1921
/// <summary>Use for full library querying. No lazy loading</summary>
2022
public static List<LibraryBook> GetLibrary_Flat_NoTracking(bool includeParents = false)
2123
{
2224
using var context = GetContext();
23-
2425
return context.GetLibrary_Flat_NoTracking(includeParents);
2526
}
2627
}

0 commit comments

Comments
 (0)