Skip to content

Commit 825170b

Browse files
committed
Merge pull request #46 from mprattinger/master
fixes #45
2 parents 5b86ce2 + c5f7c20 commit 825170b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

SQLite.CodeFirst.Console/App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
55
</configSections>
66
<connectionStrings>
7-
<add name="footballDb" connectionString="data source=.\footballDb.sqlite;foreign keys=true" providerName="System.Data.SQLite" />
7+
<add name="footballDb" connectionString="data source=.\db\footballDb\footballDb.sqlite;foreign keys=true" providerName="System.Data.SQLite" />
88
</connectionStrings>
99
<startup>
1010
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

SQLite.CodeFirst/SqliteInitializerBase.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Data.Entity;
33
using System.Data.Entity.ModelConfiguration.Conventions;
44
using SQLite.CodeFirst.Convention;
5+
using System.IO;
56

67
namespace SQLite.CodeFirst
78
{
@@ -60,6 +61,11 @@ public virtual void InitializeDatabase(TContext context)
6061
{
6162
var model = modelBuilder.Build(context.Database.Connection);
6263

64+
var dbFile = GetDatabasePathFromContext(context);
65+
var dbFileInfo = new FileInfo(dbFile);
66+
dbFileInfo.Directory.Create();
67+
68+
6369
using (var transaction = context.Database.BeginTransaction())
6470
{
6571
try

0 commit comments

Comments
 (0)