Added Data
This commit is contained in:
151
Data/RedditContext.cs
Normal file
151
Data/RedditContext.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SaltMiner.Data;
|
||||
|
||||
public partial class RedditContext : DbContext
|
||||
{
|
||||
public RedditContext()
|
||||
{
|
||||
}
|
||||
|
||||
public RedditContext(DbContextOptions<RedditContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<ArchiveStatus> ArchiveStatuses { get; set; }
|
||||
|
||||
public virtual DbSet<Comment> Comments { get; set; }
|
||||
|
||||
public virtual DbSet<Link> Links { get; set; }
|
||||
|
||||
public virtual DbSet<Subreddit> Subreddits { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
#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 https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
=> optionsBuilder.UseSqlServer("Server=elysium.chrispr.lan;Database=Reddit;User Id=reddit;Password=reddit;TrustServerCertificate=True");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<ArchiveStatus>(entity =>
|
||||
{
|
||||
entity.ToTable("ArchiveStatus");
|
||||
|
||||
entity.Property(e => e.ArchiveStatusId).HasColumnName("ArchiveStatusID");
|
||||
entity.Property(e => e.CommentId)
|
||||
.HasMaxLength(256)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("CommentID");
|
||||
entity.Property(e => e.FileName)
|
||||
.HasMaxLength(256)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.LinkId)
|
||||
.HasMaxLength(256)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("LinkID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Comment>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.CommentId, e.Created });
|
||||
|
||||
entity.HasIndex(e => e.LinkId, "IX_Comments_LinkID");
|
||||
|
||||
entity.Property(e => e.CommentId)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("CommentID");
|
||||
entity.Property(e => e.Created).HasColumnType("datetime");
|
||||
entity.Property(e => e.ApprovedBy).HasMaxLength(64);
|
||||
entity.Property(e => e.Author).HasMaxLength(64);
|
||||
entity.Property(e => e.AuthorFlairCssclass)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("AuthorFlairCSSClass");
|
||||
entity.Property(e => e.AuthorFlairText)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.Distinguished)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.LinkId)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("LinkID");
|
||||
entity.Property(e => e.ParentId)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("ParentID");
|
||||
entity.Property(e => e.RetrievedOn).HasColumnType("datetime");
|
||||
entity.Property(e => e.SubredditId)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("SubredditID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Link>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.LinkId, e.Created });
|
||||
|
||||
entity.Property(e => e.LinkId)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("LinkID");
|
||||
entity.Property(e => e.Created).HasColumnType("datetime");
|
||||
entity.Property(e => e.Author).HasMaxLength(64);
|
||||
entity.Property(e => e.AuthorFlairCssclass)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("AuthorFlairCSSClass");
|
||||
entity.Property(e => e.AuthorFlairText)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.Distinguished)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.Domain)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.Edited).HasColumnType("datetime");
|
||||
entity.Property(e => e.LinkFlairCssclass)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("LinkFlairCSSClass");
|
||||
entity.Property(e => e.LinkFlairText)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.RetrievedOn).HasColumnType("datetime");
|
||||
entity.Property(e => e.SubredditId)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("SubredditID");
|
||||
entity.Property(e => e.Thumbnail)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(1024)
|
||||
.IsUnicode(false);
|
||||
entity.Property(e => e.Url)
|
||||
.HasMaxLength(4096)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("URL");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Subreddit>(entity =>
|
||||
{
|
||||
entity.Property(e => e.SubredditId)
|
||||
.HasMaxLength(64)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("SubredditID");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(256)
|
||||
.IsUnicode(false);
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
Reference in New Issue
Block a user