Initial commit AB#12
This commit is contained in:
52
venues/DbContexts/MlbGameDayContext.cs
Normal file
52
venues/DbContexts/MlbGameDayContext.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Venues.Entities;
|
||||
|
||||
namespace Venues.DbContexts
|
||||
{
|
||||
public partial class MlbGameDayContext : DbContext
|
||||
{
|
||||
public MlbGameDayContext()
|
||||
{
|
||||
}
|
||||
|
||||
public MlbGameDayContext(DbContextOptions<MlbGameDayContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Venue> Venues { get; set; } = null!;
|
||||
|
||||
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
//{
|
||||
// if (!optionsBuilder.IsConfigured)
|
||||
// {
|
||||
// optionsBuilder.UseNpgsql("Host=localhost;Database=mlb-game-day;Username=postgres;Password=postgres");
|
||||
// }
|
||||
//}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Venue>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
entity.ToTable("venue");
|
||||
|
||||
entity.Property(e => e.Active).HasColumnName("active");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
|
||||
entity.Property(e => e.Link).HasColumnName("link");
|
||||
|
||||
entity.Property(e => e.Name).HasColumnName("name");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user