using e_suite.Database.Core.Tables.Contacts; using e_suite.Database.Core.Tables.Domain; using System.ComponentModel.DataAnnotations; namespace e_suite.Workflow.Core; public class TaskAssignee : ITaskAssignee, IValidatableObject { public Role? Role { get; set; } public Contact? Contact { get; set; } public Raci Raci { get; set; } public IEnumerable Validate(ValidationContext validationContext) { if (!((Role != null) ^ (Contact != null))) //Role Xor Contact means either must be set, but not both the same { yield return new ValidationResult( "Either Role or Contact must be set, but not both.", [nameof(Role), nameof(Contact)] ); } } }