File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
SQLite.CodeFirst/DbInitializers Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections . Generic ;
23using System . Data . Common ;
34using System . Data . Entity ;
5+ using System . Data . Entity . Infrastructure ;
46using System . IO ;
57using System . Linq ;
68using SQLite . CodeFirst . Utility ;
@@ -139,12 +141,11 @@ private bool IsSameModel(TContext context)
139141
140142 private IHistory GetHistoryRecord ( TContext context )
141143 {
142- return context . Set ( historyEntityType )
143- . AsNoTracking ( )
144- . ToListAsync ( )
145- . Result
146- . Cast < IHistory > ( )
147- . SingleOrDefault ( ) ;
144+ // Yes, it seams to be complicated but it has to be done this way
145+ // in order to be supported by .NET 4.0.
146+ DbQuery dbQuery = context . Set ( historyEntityType ) . AsNoTracking ( ) ;
147+ IEnumerable < IHistory > records = Enumerable . Cast < IHistory > ( dbQuery ) ;
148+ return records . SingleOrDefault ( ) ;
148149 }
149150
150151 private string GetHashFromModel ( DbConnection connection )
You can’t perform that action at this time.
0 commit comments