|
@@ -5,20 +5,6 @@ using InABox.Core;
|
|
|
|
|
|
namespace Comal.Classes
|
|
|
{
|
|
|
-
|
|
|
- public class NotificationDocumentCount : CoreAggregate<Notification, NotificationDocument, Guid>
|
|
|
- {
|
|
|
- public override Expression<Func<NotificationDocument, Guid>> Aggregate => x => x.ID;
|
|
|
-
|
|
|
- public override AggregateCalculation Calculation => AggregateCalculation.Count;
|
|
|
-
|
|
|
- public override Dictionary<Expression<Func<NotificationDocument, object>>, Expression<Func<Notification, object>>> Links =>
|
|
|
- new Dictionary<Expression<Func<NotificationDocument, object>>, Expression<Func<Notification, object>>>()
|
|
|
- {
|
|
|
- { NotificationDocument => NotificationDocument.EntityLink.ID, Notification => Notification.ID }
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
[UserTracking("Notifications")]
|
|
|
public class Notification : Entity, IRemotable, IPersistent, IOneToMany<Job>, ILicense<CoreLicense>
|
|
|
{
|
|
@@ -76,9 +62,14 @@ namespace Comal.Classes
|
|
|
|
|
|
[NullEditor]
|
|
|
public Guid EntityID { get; set; }
|
|
|
-
|
|
|
+
|
|
|
+ private class DocumentCountFormula : ComplexFormulaGenerator<Notification, int>
|
|
|
+ {
|
|
|
+ public override IComplexFormulaNode<Notification, int> GetFormula() =>
|
|
|
+ Count<NotificationDocument, Guid>(x => x.Property(x => x.ID)).WithLink(x => x.EntityLink.ID, x => x.ID);
|
|
|
+ }
|
|
|
[NullEditor]
|
|
|
- [Aggregate(typeof(NotificationDocumentCount))]
|
|
|
+ [ComplexFormula(typeof(DocumentCountFormula))]
|
|
|
public int DocumentCount { get; set; }
|
|
|
}
|
|
|
}
|