enable-migrations -ContextTypeName Contex -MigrationsDirectory ContexMigrations
Add-migration -configuration MVC.ContexMigrations.Configuration Initial
Update-database -configuration MVC.ContexMigrations.Configuration
public IEnumerable<Book> GetBooks(int id)
{
var books = db.Books.Where(x => x.BookId > id).ToList();
return books;
}
Database.SetInitializer(new CreateDatabaseIfNotExists<DbEntity>());
using (DbEntitycontext = new DbEntity())
{
var query = context.Players.ToList();
}
using (DbEntitycontext = new DbEntity())
{
context.Database.Create();
}