Skip to content

Commit 8064a2f

Browse files
committed
Update Configure.Db.cs
1 parent 818d82e commit 8064a2f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

MyApp/Configure.Db.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using ServiceStack.Data;
33
using ServiceStack.OrmLite;
44
using MyApp.Data;
5+
using Microsoft.EntityFrameworkCore.Diagnostics;
56

67
[assembly: HostingStartup(typeof(MyApp.ConfigureDb))]
78

@@ -12,14 +13,16 @@ public class ConfigureDb : IHostingStartup
1213
public void Configure(IWebHostBuilder builder) => builder
1314
.ConfigureServices((context, services) => {
1415
var connectionString = context.Configuration.GetConnectionString("DefaultConnection")
15-
?? "DataSource=App_Data/app.db;Cache=Shared";
16+
?? "DataSource=App_Data/app.db;Cache=Shared";
1617

1718
services.AddOrmLite(options => options.UseSqlite(connectionString));
1819

1920
// $ dotnet ef migrations add CreateIdentitySchema
2021
// $ dotnet ef database update
21-
services.AddDbContext<ApplicationDbContext>(options =>
22-
options.UseSqlite(connectionString, b => b.MigrationsAssembly(nameof(MyApp))));
22+
services.AddDbContext<ApplicationDbContext>(options => {
23+
options.UseSqlite(connectionString, b => b.MigrationsAssembly(nameof(MyApp)));
24+
options.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning));
25+
});
2326

2427
// Enable built-in Database Admin UI at /admin-ui/database
2528
services.AddPlugin(new AdminDatabaseFeature());

0 commit comments

Comments
 (0)