Adds Database Structure in C# with Entity Framework
This commit is contained in:
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!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user