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