99using  Microsoft . Extensions . DependencyInjection ; 
1010using  Microsoft . Extensions . Logging ; 
1111using  Microsoft . AspNetCore . Http ; 
12+ using  Microsoft . EntityFrameworkCore ; 
1213
1314using  Microsoft . AspNetCore . NodeServices ; 
15+ using  AspCoreServer . Data ; 
1416
1517namespace  AspCoreServer 
1618{ 
@@ -35,10 +37,15 @@ public void ConfigureServices(IServiceCollection services)
3537            services . AddMvc ( ) ; 
3638
3739            services . AddNodeServices ( ) ; 
40+ 
41+             var  connectionStringBuilder  =  new  Microsoft . Data . Sqlite . SqliteConnectionStringBuilder  {  DataSource  =  "spa.db"  } ; 
42+             var  connectionString  =  connectionStringBuilder . ToString ( ) ; 
43+             services . AddDbContext < SpaDbContext > ( options => 
44+                 options . UseSqlite ( connectionString ) ) ; 
3845        } 
3946
4047        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 
41-         public  void  Configure ( IApplicationBuilder  app ,  IHostingEnvironment  env ,  ILoggerFactory  loggerFactory ) 
48+         public  void  Configure ( IApplicationBuilder  app ,  IHostingEnvironment  env ,  ILoggerFactory  loggerFactory ,   SpaDbContext   context ) 
4249        { 
4350            loggerFactory . AddConsole ( Configuration . GetSection ( "Logging" ) ) ; 
4451            loggerFactory . AddDebug ( ) ; 
@@ -49,6 +56,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
4956                app . UseWebpackDevMiddleware ( new  WebpackDevMiddlewareOptions  { 
5057                    HotModuleReplacement  =  true 
5158                } ) ; 
59+                 DbInitializer . Initialize ( context ) ; 
5260            } 
5361            else 
5462            { 
0 commit comments