Composite key (PersonId, UserId) was only defined via Fluent API; [PrimaryKey] makes the model class self-documenting.
33 lines
902 B
C#
33 lines
902 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Lactose.Models;
|
|
|
|
/// <summary>
|
|
/// Represents the many-to-many relationship between maintainer users and the cosplayers they maintain.
|
|
/// </summary>
|
|
[PrimaryKey(nameof(PersonId), nameof(UserId))]
|
|
public class PersonMaintainer {
|
|
/// <summary>
|
|
/// Gets or sets the person (cosplayer) ID.
|
|
/// </summary>
|
|
[ForeignKey(nameof(Person))]
|
|
public Guid PersonId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the person (cosplayer).
|
|
/// </summary>
|
|
public Person Person { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maintainer user ID.
|
|
/// </summary>
|
|
[ForeignKey(nameof(User))]
|
|
public Guid UserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maintainer user.
|
|
/// </summary>
|
|
public User User { get; set; } = null!;
|
|
}
|