public override void InitializeDatabase(LibraryDb context) { context.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction , string.Format("ALTER DATABASE [{0}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE", context.Database.Connection.Database)); base.InitializeDatabase(context); }
public List <Renting> readRentings() { var db = new LibraryDb(); var rentingsFromDb = new List <Renting>(); if (db.Readers.Any()) { var query = from renting in db.Rentings select renting; foreach (var renting in query) { rentingsFromDb.Add(renting); } } return(rentingsFromDb); }
public List <Author> readAuthors() { var db = new LibraryDb(); var authorsFromDb = new List <Author>(); if (db.Authors.Any()) { var query = from author in db.Authors select author; foreach (var author in query) { authorsFromDb.Add(author); } } return(authorsFromDb); }
public List <Reader> readReaders() { var db = new LibraryDb(); var readersFromDb = new List <Reader>(); if (db.Readers.Any()) { var query = from reader in db.Readers select reader; foreach (var reader in query) { readersFromDb.Add(reader); } } return(readersFromDb); }
public List <Book> readBooks() { var db = new LibraryDb(); var booksFromDb = new List <Book>(); if (db.Books.Any()) { var query = from book in db.Books select book; foreach (var book in query) { booksFromDb.Add(book); } } return(booksFromDb); }
public List <Librarian> readLibrarians() { var db = new LibraryDb(); var librariansFromDb = new List <Librarian>(); if (db.Librarians.Any()) { var query = from librarian in db.Librarians select librarian; foreach (var librarian in query) { librariansFromDb.Add(librarian); } } return(librariansFromDb); }
public List <Librarian> readLibrariansStartingWith(String start) { var db = new LibraryDb(); var librariansFromDb = new List <Librarian>(); if (db.Librarians.Any()) { var query = from librarian in db.Librarians where librarian.firstName.StartsWith(start) select librarian; foreach (var librarian in query) { librariansFromDb.Add(librarian); } } return(librariansFromDb); }
protected override void Seed(LibraryDb context) { // Seed code goes here... base.Seed(context); }
public MaintainDb() { db = new LibraryDb(); }