This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//debugging I can see this db getting created in file explorer | |
//the savechanges throws every time (from a test or from app) with SQLite exception "SQL logic error or missing database" | |
using (var contextCreateDb = new BreweryContext()) | |
{ | |
//database exists seems to be working with current ef7 build but not delete yet | |
//if (contextCreateDb.Database.Exists()) { | |
// contextCreateDb.Database.Delete(); //but delete doesnt work yet ;) | |
// } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.config({ | |
defaultJSExtensions: true, | |
transpiler: "babel", | |
babelOptions: { | |
"optional": [ | |
"es7.decorators", | |
"es7.classProperties", | |
"runtime" | |
] | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Seeder | |
{ | |
public static void Seedit(string jsonData, IServiceProvider serviceProvider) | |
{ | |
List<WeatherEvent> events = | |
JsonConvert.DeserializeObject<List<WeatherEvent>>(jsonData); | |
using (var serviceScope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope()) | |
{ | |
var context = serviceScope.ServiceProvider.GetService<WeatherContext>(); | |
if (!context.WeatherEvents.Any()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**TEST #1: First() **** | |
Assert.IsInstanceOfType(_context.Samurais.First(s => s.Id == 1),typeof(Samurai)); | |
COMPILING QUERY MODEL: | |
'(from Samurai s in DbSet<Samurai> | |
where s.Id == 1 | |
select s) | |
.First()' | |
Optimized query model: | |
'(from Samurai s in DbSet<Samurai> |