Код: Выделить всё
[Table("opcr")]
public class Opcr
{
[Key]
public int Id { get; set; }
[Required]
public string? Title { get; set; }
[Required]
public string DepartmentHeadId { get; set; }
[ForeignKey(nameof(DepartmentHeadId))]
public ApplicationUser DepartmentHead { get; set; }
[Required]
public string EvaluatedById { get; set; }
[ForeignKey(nameof(EvaluatedById))]
public ApplicationUser EvaluatedBy { get; set; }
[Required]
public string ReviewedById { get; set; }
[ForeignKey(nameof(ReviewedById))]
public ApplicationUser ReviewedBy { get; set; }
}
Код: Выделить всё
using Microsoft.AspNetCore.Identity;
using System.ComponentModel.DataAnnotations;
namespace LGU_HR.Models;
public class ApplicationUser : IdentityUser
{
[Required]
[MaxLength(50)]
public string? FirstName { get; set; }
[Required]
[MaxLength(50)]
public string? LastName { get; set; }
// public ICollection DepartmentHead { get; }
Подробнее здесь: [url]https://stackoverflow.com/questions/79096337/how-to-add-navigations-on-multiple-column-in-one-to-many-relationshiop-on-net-e[/url]