Adds Database Structure in C# with Entity Framework
This commit is contained in:
17
WatchLog/Data/Database/Global/Admin.cs
Normal file
17
WatchLog/Data/Database/Global/Admin.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class Admin
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public required string Password { get; set; } // Important: Save as HASH
|
||||
}
|
||||
}
|
||||
23
WatchLog/Data/Database/Global/Genre.cs
Normal file
23
WatchLog/Data/Database/Global/Genre.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class Genre
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
public virtual ICollection<LinkTableGlobalGenre> LinkTableGlobalGenres { get; set; } = new List<LinkTableGlobalGenre>();
|
||||
}
|
||||
}
|
||||
45
WatchLog/Data/Database/Global/GlobalEntity.cs
Normal file
45
WatchLog/Data/Database/Global/GlobalEntity.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class GlobalEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public required string Title { get; set; }
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? PicturePath { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Foreign Keys ---
|
||||
[Required]
|
||||
public int TypeId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(TypeId))]
|
||||
public virtual Type Type { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(CreatorId))]
|
||||
public virtual User User { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<LinkTableGlobalGenre> LinkTableGlobalGenres { get; set; } = new List<LinkTableGlobalGenre>();
|
||||
|
||||
public virtual ICollection<PrivateEntity> PrivateEntities { get; set; } = new List<PrivateEntity>();
|
||||
|
||||
public virtual ICollection<SharedListEntity> SharedListEntities { get; set; } = new List<SharedListEntity>();
|
||||
}
|
||||
}
|
||||
24
WatchLog/Data/Database/Global/LinkTableGlobalGenre.cs
Normal file
24
WatchLog/Data/Database/Global/LinkTableGlobalGenre.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
[PrimaryKey(nameof(GlobalEntityId), nameof(GenreId))]
|
||||
public class LinkTableGlobalGenre
|
||||
{
|
||||
// --- Foreign Keys ---
|
||||
[Column(Order = 0)]
|
||||
public int GlobalEntityId { get; set; }
|
||||
|
||||
[Column(Order = 1)]
|
||||
public int GenreId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(GlobalEntityId))]
|
||||
public virtual GlobalEntity GlobalEntity { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(GenreId))]
|
||||
public virtual Genre Genre { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
22
WatchLog/Data/Database/Global/StreamingPlatform.cs
Normal file
22
WatchLog/Data/Database/Global/StreamingPlatform.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class StreamingPlatform
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? PicturePath { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
}
|
||||
}
|
||||
18
WatchLog/Data/Database/Global/Type.cs
Normal file
18
WatchLog/Data/Database/Global/Type.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class Type
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Property ---
|
||||
public virtual ICollection<GlobalEntity> GlobalEntities { get; set; } = new List<GlobalEntity>();
|
||||
}
|
||||
}
|
||||
32
WatchLog/Data/Database/Global/User.cs
Normal file
32
WatchLog/Data/Database/Global/User.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class User
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? Email { get; set; }
|
||||
|
||||
[Required]
|
||||
public required string Password { get; set; } // Important: Save as HASH
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
public virtual ICollection<PrivateEntity> PrivateEntities { get; set; } = new List<PrivateEntity>();
|
||||
|
||||
public virtual ICollection<GlobalEntity> GlobalEntities { get; set; } = new List<GlobalEntity>();
|
||||
|
||||
public virtual ICollection<Label> Labels { get; set; } = new List<Label>();
|
||||
|
||||
public virtual ICollection<UserWatchStatus> UserWatchStatuses { get; set; } = new List<UserWatchStatus>();
|
||||
|
||||
public virtual ICollection<LinkTableSharedUser> LinkTableSharedUsers { get; set; } = new List<LinkTableSharedUser>();
|
||||
}
|
||||
}
|
||||
32
WatchLog/Data/Database/Private/Label.cs
Normal file
32
WatchLog/Data/Database/Private/Label.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class Label
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Foreign Key ---
|
||||
[Required]
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(CreatorId))]
|
||||
public virtual User User { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<LinkTablePrivateLabel> LinkTablePrivateLabels { get; set; } = new List<LinkTablePrivateLabel>();
|
||||
}
|
||||
}
|
||||
21
WatchLog/Data/Database/Private/LinkTablePrivateLabel.cs
Normal file
21
WatchLog/Data/Database/Private/LinkTablePrivateLabel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
[PrimaryKey(nameof(PrivateEntityId), nameof(LabelId))]
|
||||
public class LinkTablePrivateLabel
|
||||
{
|
||||
// --- Foreign Keys ---
|
||||
public int PrivateEntityId { get; set; }
|
||||
public int LabelId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(PrivateEntityId))]
|
||||
public virtual PrivateEntity PrivateEntity { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(LabelId))]
|
||||
public virtual Label Label { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
[PrimaryKey(nameof(PrivateEntityId), nameof(StreamingPlatformId))]
|
||||
public class LinkTablePrivateStreamingPlatform
|
||||
{
|
||||
// --- Foreign Keys ---
|
||||
public int PrivateEntityId { get; set; }
|
||||
public int StreamingPlatformId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(PrivateEntityId))]
|
||||
public virtual PrivateEntity PrivateEntity { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(StreamingPlatformId))]
|
||||
public virtual StreamingPlatform StreamingPlatform { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
52
WatchLog/Data/Database/Private/PrivateEntity.cs
Normal file
52
WatchLog/Data/Database/Private/PrivateEntity.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class PrivateEntity
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public bool Favorite { get; set; } = false;
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public int? Season { get; set; }
|
||||
|
||||
public int? Episode { get; set; }
|
||||
|
||||
public int? Rating { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Foreign Keys ---
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int GlobalEntityId { get; set; }
|
||||
|
||||
public int? UserWatchStatusId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public virtual User User { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(GlobalEntityId))]
|
||||
public virtual GlobalEntity GlobalEntity { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(UserWatchStatusId))]
|
||||
public virtual UserWatchStatus? UserWatchStatus { get; set; }
|
||||
|
||||
public virtual ICollection<LinkTablePrivateLabel> PrivateEntityLabels { get; set; } = new List<LinkTablePrivateLabel>();
|
||||
|
||||
public virtual ICollection<LinkTablePrivateStreamingPlatform> PrivateStreamingPlatforms { get; set; } = new List<LinkTablePrivateStreamingPlatform>();
|
||||
}
|
||||
}
|
||||
38
WatchLog/Data/Database/Private/UserWatchStatus.cs
Normal file
38
WatchLog/Data/Database/Private/UserWatchStatus.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class UserWatchStatus
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[MaxLength(7)]
|
||||
public string? ColorCode { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Foreign Key ---
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public virtual User User { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<PrivateEntity> PrivateEntities { get; set; } = new List<PrivateEntity>();
|
||||
}
|
||||
}
|
||||
22
WatchLog/Data/Database/Shared/LinkTableSharedLabel.cs
Normal file
22
WatchLog/Data/Database/Shared/LinkTableSharedLabel.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
[PrimaryKey(nameof(SharedListLabelId), nameof(SharedListEntityId))]
|
||||
public class LinkTableSharedLabel
|
||||
{
|
||||
// --- Foreign Keys ---
|
||||
public int SharedListLabelId { get; set; }
|
||||
|
||||
public int SharedListEntityId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(SharedListLabelId))]
|
||||
public virtual SharedListLabel SharedListLabel { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(SharedListEntityId))]
|
||||
public virtual SharedListEntity SharedListEntity { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
[PrimaryKey(nameof(SharedListEnityId), nameof(StreamingPlatformId))]
|
||||
public class LinkTableSharedStreamingPlatform
|
||||
{
|
||||
// --- Foreign Keys ---
|
||||
public int SharedListEnityId { get; set; }
|
||||
public int StreamingPlatformId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(SharedListEnityId))]
|
||||
public virtual SharedListEntity SharedListEntity { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(StreamingPlatformId))]
|
||||
public virtual StreamingPlatform StreamingPlatform { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
21
WatchLog/Data/Database/Shared/LinkTableSharedUser.cs
Normal file
21
WatchLog/Data/Database/Shared/LinkTableSharedUser.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
[PrimaryKey(nameof(SharedListId), nameof(UserId))]
|
||||
public class LinkTableSharedUser
|
||||
{
|
||||
// --- Foreign Keys ---
|
||||
public int SharedListId { get; set; }
|
||||
public int UserId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(SharedListId))]
|
||||
public virtual SharedList SharedList { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public virtual User User { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
32
WatchLog/Data/Database/Shared/SharedList.cs
Normal file
32
WatchLog/Data/Database/Shared/SharedList.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class SharedList
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(150)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
public virtual ICollection<LinkTableSharedUser> SharedListUsers { get; set; } = new List<LinkTableSharedUser>();
|
||||
|
||||
public virtual ICollection<SharedListEntity> SharedListEntities { get; set; } = new List<SharedListEntity>();
|
||||
|
||||
public virtual ICollection<SharedWatchStatus> SharedWatchStatuses { get; set; } = new List<SharedWatchStatus>();
|
||||
|
||||
public virtual ICollection<SharedListLabel> SharedListLabels { get; set; } = new List<SharedListLabel>();
|
||||
}
|
||||
}
|
||||
48
WatchLog/Data/Database/Shared/SharedListEntity.cs
Normal file
48
WatchLog/Data/Database/Shared/SharedListEntity.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
[PrimaryKey(nameof(SharedListId), nameof(GlobalEntityId))]
|
||||
public class SharedListEntity
|
||||
{
|
||||
// --- Foreign Keys ---
|
||||
public int SharedListId { get; set; }
|
||||
public int GlobalEntityId { get; set; }
|
||||
|
||||
// --- Weiterer Foreign Key ---
|
||||
public int? SharedWatchStatusId { get; set; }
|
||||
|
||||
|
||||
// --- Datenfelder für den Listeneintrag ---
|
||||
public bool Favorite { get; set; } = false;
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public int? Season { get; set; }
|
||||
|
||||
public int? Episode { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(SharedListId))]
|
||||
public virtual SharedList SharedList { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(GlobalEntityId))]
|
||||
public virtual GlobalEntity GlobalEntity { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(SharedWatchStatusId))]
|
||||
public virtual SharedWatchStatus? SharedWatchStatus { get; set; }
|
||||
|
||||
public virtual ICollection<LinkTableSharedLabel> LinkTableSharedLabels { get; set; } = new List<LinkTableSharedLabel>();
|
||||
|
||||
public virtual ICollection<LinkTablePrivateStreamingPlatform> LinkTablePrivateStreamingPlatforms { get; set; } = new List<LinkTablePrivateStreamingPlatform>();
|
||||
}
|
||||
}
|
||||
37
WatchLog/Data/Database/Shared/SharedListLabel.cs
Normal file
37
WatchLog/Data/Database/Shared/SharedListLabel.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class SharedListLabel
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Foreign Key ---
|
||||
[Required]
|
||||
public int SharedListId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(SharedListId))]
|
||||
public virtual SharedList SharedList { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<LinkTableSharedLabel> LinkTableSharedLabels { get; set; } = new List<LinkTableSharedLabel>();
|
||||
}
|
||||
}
|
||||
43
WatchLog/Data/Database/Shared/SharedWatchStatus.cs
Normal file
43
WatchLog/Data/Database/Shared/SharedWatchStatus.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WatchLog.Data
|
||||
{
|
||||
public class SharedWatchStatus
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[MaxLength(7)]
|
||||
public string? ColorCode { get; set; }
|
||||
|
||||
[Required]
|
||||
public required DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime? LastChange { get; set; }
|
||||
|
||||
|
||||
// --- Foreign Key ---
|
||||
[Required]
|
||||
public int SharedListId { get; set; }
|
||||
|
||||
|
||||
// --- Navigation Properties ---
|
||||
[ForeignKey(nameof(SharedListId))]
|
||||
public virtual SharedList SharedList { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<SharedListEntity> SharedListEntities { get; set; } = new List<SharedListEntity>();
|
||||
}
|
||||
}
|
||||
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