public CodeAFriendContext NewContext() { var context = new CodeAFriendContext(Options); _contexts.Add(context); return(context); }
public InMemoryCodeAFriendDatabase(bool ensureSchema = true) { Connection.Open(); Options = new DbContextOptionsBuilder <CodeAFriendContext>().UseSqlite(Connection).Options; // Create the schema in the database if (ensureSchema) { using (var context = new CodeAFriendContext(Options)) { context.Database.EnsureCreated(); } } }