Adds Database Structure in C# with Entity Framework
This commit is contained in:
44
WatchLog/Data/WatchLogDataContext.cs
Normal file
44
WatchLog/Data/WatchLogDataContext.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class WatchLogDataContext : DbContext
|
||||
{
|
||||
protected readonly IConfiguration Configuration;
|
||||
|
||||
public WatchLogDataContext(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite(Configuration.GetConnectionString("WatchLogDB"));
|
||||
}
|
||||
|
||||
// Global
|
||||
public DbSet<Admin> Admins { get; set; }
|
||||
public DbSet<Genre> Genres { get; set; }
|
||||
public DbSet<GlobalEntity> GlobalEntities { get; set; }
|
||||
//public DbSet<LinkTableGlobalGenre> LinkTableGlobalGenres { get; set; }
|
||||
public DbSet<StreamingPlatform> StreamingPlatforms { get; set; }
|
||||
public DbSet<Type> Types { get; set; } // 'Watchlog.Data.Type' if namecolsion with System.Type
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
||||
//Private
|
||||
public DbSet<Label> Labels { get; set; }
|
||||
//public DbSet<LinkTablePrivateLabel> LinkTablePrivateLabels { get; set; }
|
||||
//public DbSet<LinkTablePrivateStreamingPlatform> LinkTablePrivateStreamingPlatform { get; set; }
|
||||
public DbSet<PrivateEntity> PrivateEntities { get; set; }
|
||||
public DbSet<UserWatchStatus> UserWatchStatuses { get; set; }
|
||||
|
||||
//Shared
|
||||
//public DbSet<LinkTableSharedLabel> LinkTableSharedLabels { get; set; }
|
||||
//public DbSet<LinkTableSharedStreamingPlatform> LinkTableSharedStreamingPlatforms { get; set; }
|
||||
//public DbSet<LinkTableSharedUser> LinkTableSharedUsers { get; set; }
|
||||
public DbSet<SharedList> SharedLists { get; set; }
|
||||
public DbSet<SharedListEntity> SharedListEntities { get; set; }
|
||||
public DbSet<SharedListLabel> SharedListLabels { get; set; }
|
||||
public DbSet<SharedWatchStatus> SharedWatchStatuses { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user