Skip to content

Commit 0dfc440

Browse files
committed
Add dbContext constructor that uses objectContext
1 parent f0c91af commit 0dfc440

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

EntityFramework.Reverse.POCO.Generator/Database NorthwindSqlCe40.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ public MyDbContextSqlCE4(System.Data.Common.DbConnection existingConnection, Sys
104104
{
105105
}
106106

107+
public MyDbContextSqlCE4(System.Data.Entity.Core.Objects.ObjectContext objectContext, bool dbContextOwnsObjectContext)
108+
: base(objectContext, dbContextOwnsObjectContext)
109+
{
110+
}
111+
107112
protected override void Dispose(bool disposing)
108113
{
109114
base.Dispose(disposing);

EntityFramework.Reverse.POCO.Generator/Database.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ public MyDbContext(System.Data.Common.DbConnection existingConnection, System.Da
172172
{
173173
}
174174

175+
public MyDbContext(System.Data.Entity.Core.Objects.ObjectContext objectContext, bool dbContextOwnsObjectContext)
176+
: base(objectContext, dbContextOwnsObjectContext)
177+
{
178+
}
179+
175180
protected override void Dispose(bool disposing)
176181
{
177182
base.Dispose(disposing);

EntityFramework.Reverse.POCO.Generator/EF.Reverse.POCO.ttinclude

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,13 @@ foreach(Table tbl in from t in Settings.Tables.Where(t => !t.IsMapping && t.HasP
271271
<#}#>
272272
}
273273

274+
public <#=Settings.DbContextName#>(System.Data.Entity.Core.Objects.ObjectContext objectContext, bool dbContextOwnsObjectContext)
275+
: base(objectContext, dbContextOwnsObjectContext)
276+
{
277+
<#if(Settings.DbContextClassIsPartial()) {#> InitializePartial();
278+
<#}#>
279+
}
280+
274281
protected override void Dispose(bool disposing)
275282
{
276283
<#if(Settings.DbContextClassIsPartial()) {#> DisposePartial(disposing);

Tester/TestDatabase_DataAnnotation.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ public TestDbContext(System.Data.Common.DbConnection existingConnection, System.
119119
{
120120
}
121121

122+
public TestDbContext(System.Data.Entity.Core.Objects.ObjectContext objectContext, bool dbContextOwnsObjectContext)
123+
: base(objectContext, dbContextOwnsObjectContext)
124+
{
125+
}
126+
122127
protected override void Dispose(bool disposing)
123128
{
124129
base.Dispose(disposing);

Tester/TestDatabase_NoDataAnnotation.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ public TestDbContext(System.Data.Common.DbConnection existingConnection, System.
117117
{
118118
}
119119

120+
public TestDbContext(System.Data.Entity.Core.Objects.ObjectContext objectContext, bool dbContextOwnsObjectContext)
121+
: base(objectContext, dbContextOwnsObjectContext)
122+
{
123+
}
124+
120125
protected override void Dispose(bool disposing)
121126
{
122127
base.Dispose(disposing);

Tester/TestSynonymsDatabase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ public TestDbContext(System.Data.Common.DbConnection existingConnection, System.
102102
{
103103
}
104104

105+
public TestDbContext(System.Data.Entity.Core.Objects.ObjectContext objectContext, bool dbContextOwnsObjectContext)
106+
: base(objectContext, dbContextOwnsObjectContext)
107+
{
108+
}
109+
105110
protected override void Dispose(bool disposing)
106111
{
107112
base.Dispose(disposing);

0 commit comments

Comments
 (0)