using System; using System.Collections.Generic; using System.Linq.Expressions; using InABox.Core; namespace Comal.Classes { public interface IJobDocumentSetFolder { String Name { get; set; } } public class JobDocumentSetFolderDocumentCount : CoreAggregate { public override Expression> Aggregate => x => x.ID; public override AggregateCalculation Calculation => AggregateCalculation.Count; public override Dictionary>, Expression>> Links => new Dictionary>, Expression>>() { { JobDocumentSet => JobDocumentSet.Folder.ID, JobDocumentSetFolder => JobDocumentSetFolder.ID } }; } public class JobDocumentSetFolder : Entity, IRemotable, IPersistent, IJobDocumentSetFolder, IOneToMany, ILicense { [EntityRelationship(DeleteAction.Cascade)] [NullEditor] public JobLink Job { get; set; } [NullEditor] [EntityRelationship(DeleteAction.Cascade)] public JobDocumentSetFolderLink Parent { get; set; } [TextBoxEditor] [EditorSequence(1)] public String Name { get; set; } [NullEditor] [Aggregate(typeof(JobDocumentSetFolderDocumentCount))] public int Documents { get; set; } } public class JobDocumentSetFolderLink : EntityLink, IJobDocumentSetFolder { [NullEditor] public override Guid ID { get; set; } public string Name { get; set; } } }