@@ -7,13 +7,11 @@ namespace SQLite.CodeFirst
77 public abstract class SqliteInitializerBase < TContext > : IDatabaseInitializer < TContext >
88 where TContext : DbContext
99 {
10- protected readonly DbModelBuilder ModelBuilder ;
11- protected readonly string DatabaseFilePath ;
10+ private readonly DbModelBuilder modelBuilder ;
1211
13- protected SqliteInitializerBase ( string connectionString , DbModelBuilder modelBuilder )
12+ protected SqliteInitializerBase ( DbModelBuilder modelBuilder )
1413 {
15- DatabaseFilePath = SqliteConnectionStringParser . GetDataSource ( connectionString ) ;
16- ModelBuilder = modelBuilder ;
14+ this . modelBuilder = modelBuilder ;
1715
1816 // This convention will crash the SQLite Provider before "InitializeDatabase" gets called.
1917 // See https://github.com/msallin/SQLiteCodeFirst/issues/7 for details.
@@ -22,7 +20,7 @@ protected SqliteInitializerBase(string connectionString, DbModelBuilder modelBui
2220
2321 public virtual void InitializeDatabase ( TContext context )
2422 {
25- var model = ModelBuilder . Build ( context . Database . Connection ) ;
23+ var model = modelBuilder . Build ( context . Database . Connection ) ;
2624
2725 using ( var transaction = context . Database . BeginTransaction ( ) )
2826 {
@@ -56,5 +54,10 @@ public virtual void InitializeDatabase(TContext context)
5654 }
5755
5856 protected virtual void Seed ( TContext context ) { }
57+
58+ protected string GetDatabasePathFromContext ( TContext context )
59+ {
60+ return SqliteConnectionStringParser . GetDataSource ( context . Database . Connection . ConnectionString ) ;
61+ }
5962 }
6063}
0 commit comments