DatabaseContext

 

The generated dbcontext will look like this:

public DbSet<Album> Albums { get; set; }
public DbSet<Artist> Artists { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<Employee> Employees { get; set; }
public DbSet<Genre> Genres { get; set; }
public DbSet<Invoice> Invoices { get; set; }
public DbSet<InvoiceLine> InvoiceLines { get; set; }
public DbSet<MediaType> MediaTypes { get; set; }
public DbSet<Playlist> Playlists { get; set; }
public DbSet<PlaylistTrack> PlaylistTracks { get; set; }
public DbSet<Track> Tracks { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Album>().ToTable("Album");
    modelBuilder.Entity<Artist>().ToTable("Artist");
    modelBuilder.Entity<Customer>().ToTable("Customer");
    modelBuilder.Entity<Employee>().ToTable("Employee");
    modelBuilder.Entity<Genre>().ToTable("Genre");
    modelBuilder.Entity<Invoice>().ToTable("Invoice");
    modelBuilder.Entity<InvoiceLine>().ToTable("InvoiceLine");
    modelBuilder.Entity<MediaType>().ToTable("MediaType");
    modelBuilder.Entity<Playlist>().ToTable("Playlist");
    modelBuilder.Entity<PlaylistTrack>().ToTable("PlaylistTrack");
    modelBuilder.Entity<Track>().ToTable("Track");
}

Was this article helpful?