GenerateDBContextFiles

<< >>

Navigation:  CodeStencil > Custom Library > Code Nanites > Table Related >

GenerateDBContextFiles

Expansion Label:

CS_GENERATE_DBCONTEXT_FILES

Dependency:


Description:

DB Context Generator and Separate Entity Config files.

 

This will generate a dbcontext file as well as separate Fluent configuration files

 

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.ApplyConfiguration(new AlbumEntityConfiguration());
    modelBuilder.ApplyConfiguration(new ArtistEntityConfiguration());
    modelBuilder.ApplyConfiguration(new CustomerEntityConfiguration());
    modelBuilder.ApplyConfiguration(new EmployeeEntityConfiguration());
    modelBuilder.ApplyConfiguration(new GenreEntityConfiguration());
    modelBuilder.ApplyConfiguration(new InvoiceEntityConfiguration());
    modelBuilder.ApplyConfiguration(new InvoiceLineEntityConfiguration());
    modelBuilder.ApplyConfiguration(new MediaTypeEntityConfiguration());
    modelBuilder.ApplyConfiguration(new PlaylistEntityConfiguration());
    modelBuilder.ApplyConfiguration(new PlaylistTrackEntityConfiguration());
    modelBuilder.ApplyConfiguration(new TrackEntityConfiguration());
}