示例#1
0
 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);
 }
示例#2
0
        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>());
        }
示例#3
0
        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>());
        }
示例#4
0
 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));
 }