public static TDomainObject Add <TDomainObject>(TDomainObject domainObject) where TDomainObject : class, IDomainObject { EventProcesser.ProcessEvent(new PreAddDomainObjectEvent <TDomainObject>(domainObject)); EventProcesser.ProcessEvent(new AddDomainObjectEvent <TDomainObject>(domainObject)); EventProcesser.ProcessEvent(new DomainObjectAddedEvent <TDomainObject>(domainObject)); return(domainObject); }
public static TDomainObject Get <TDomainObject, TDomainObjectId>(TDomainObjectId domainObjectId) where TDomainObject : class, IDomainObject <TDomainObjectId> { var queryDomainObjectEvent = new GetDomainObjectEvent <TDomainObject, TDomainObjectId>(domainObjectId); EventProcesser.ProcessEvent(queryDomainObjectEvent); return(queryDomainObjectEvent.GetTypedResult <TDomainObject>()); }
public static List <TDomainObject> Find <TDomainObject>(FindDomainObjectsEvent <TDomainObject> findDomainObjectsEvent) where TDomainObject : class, IDomainObject { EventProcesser.ProcessEvent(findDomainObjectsEvent); var result = findDomainObjectsEvent.GetTypedResult <IEnumerable <TDomainObject> >(); if (result != null) { return(result.ToList()); } return(new List <TDomainObject>()); }
public static void Remove <TDomainObject>(TDomainObject domainObject) where TDomainObject : class, IDomainObject { EventProcesser.ProcessEvent(new PreRemoveDomainObjectEvent <TDomainObject>(domainObject)); EventProcesser.ProcessEvent(new RemoveDomainObjectEvent <TDomainObject>(domainObject)); EventProcesser.ProcessEvent(new DomainObjectRemovedEvent <TDomainObject>(domainObject)); }