Major update
This commit is contained in:
69
divisions/DbContexts/DivisionsContext.cs
Normal file
69
divisions/DbContexts/DivisionsContext.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Divisions.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
namespace Divisions.DbContexts
|
||||
{
|
||||
public partial class DivisionsContext : DbContext
|
||||
{
|
||||
public DivisionsContext()
|
||||
{
|
||||
}
|
||||
|
||||
public DivisionsContext(DbContextOptions<DivisionsContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Division> Divisions { get; set; } = null!;
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5410;Database=divisions;Username=postgres;Password=postgres");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Division>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
entity.ToTable("division");
|
||||
|
||||
entity.Property(e => e.Abbreviation).HasColumnName("abbreviation");
|
||||
|
||||
entity.Property(e => e.Active).HasColumnName("active");
|
||||
|
||||
entity.Property(e => e.HasWildcard).HasColumnName("hasWildcard");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
|
||||
entity.Property(e => e.LeagueId).HasColumnName("leagueId");
|
||||
|
||||
entity.Property(e => e.Link).HasColumnName("link");
|
||||
|
||||
entity.Property(e => e.Name).HasColumnName("name");
|
||||
|
||||
entity.Property(e => e.NameShort).HasColumnName("nameShort");
|
||||
|
||||
entity.Property(e => e.NumPlayoffTeams).HasColumnName("numPlayoffTeams");
|
||||
|
||||
entity.Property(e => e.Season).HasColumnName("season");
|
||||
|
||||
entity.Property(e => e.SortOrder).HasColumnName("sortOrder");
|
||||
|
||||
entity.Property(e => e.SportId).HasColumnName("sportId");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user