Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        protected override void Seed(LibraryDb context)
        {
            // Seed code goes here...

            base.Seed(context);
        }
Esempio n. 9
0
 public MaintainDb()
 {
     db = new LibraryDb();
 }