53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Venues.Entities;
|
|
|
|
namespace Venues.DbContexts
|
|
{
|
|
public partial class VenuesContext : DbContext
|
|
{
|
|
public VenuesContext()
|
|
{
|
|
}
|
|
|
|
public VenuesContext(DbContextOptions<VenuesContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
public virtual DbSet<Venue> Venues { get; set; } = null!;
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
optionsBuilder.UseNpgsql("Host=localhost;Port=5460;Database=venues;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);
|
|
}
|
|
}
|