Disease.cs 850 Bytes
Newer Older
1
using Domain.Entities.People.Patients.Relations.PatientDiseases;
2
using Domain.Exceptions.InvalidValue;
3 4 5 6
using Domain.Primitives;

namespace Domain.Entities.Medicals.Diseases;

7
public sealed class Disease : Entity
8
{
9 10 11 12 13 14 15 16 17 18
    #region Private ctor
    private Disease(int id) : base(id) { }

    private Disease(int id, string name) : base(id)
    {
        Name = name;
    }

    #endregion

19 20 21 22 23 24 25 26 27 28 29
    #region Properties

    public string Name { get; set; } = null!;

    #region Navigations

    public ICollection<PatientDisease> Patients { get; set; } = [];

    #endregion

    #endregion
30 31 32 33 34 35 36 37 38 39 40 41 42

    #region Methods

    #region Static factory
    public static Disease Create(string name)
    {
        if (name is null)
            throw new InvalidValuesDomainException<Disease>();
        return new Disease(0, name);
    }
    #endregion

    #endregion
43
}