Skip to content

Instantly share code, notes, and snippets.

View julielerman's full-sized avatar

Julie Lerman julielerman

View GitHub Profile
@julielerman
julielerman / gist:ff55cd76b8af1cea5eb2
Last active August 29, 2015 14:01
trouble ...starts with a t and that rhymes with p
//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 ;)
// }
@julielerman
julielerman / config.js
Created April 22, 2016 16:42
config.js for aurelia app that is complaining about aurelia.globalResources is not a function after updating packages
System.config({
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"es7.decorators",
"es7.classProperties",
"runtime"
]
},
@julielerman
julielerman / Static Seed
Created August 3, 2016 03:07
Static class for seeding via EF, uses IServiceScopeFactory
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())
@julielerman
julielerman / Single vs First Logs EF Core
Last active November 4, 2016 13:54
EF Core 1.1 Preview Logs for Single & First Comparisons
**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>