public override bool Equals(object anotherObject) { bool equalObjects = false; if (anotherObject != null && this.GetType() == anotherObject.GetType()) { TimeConstrainedProcessTracker typedObject = (TimeConstrainedProcessTracker)anotherObject; equalObjects = this.TenantId.Equals(typedObject.TenantId) && this.ProcessId.Equals(typedObject.ProcessId); } return(equalObjects); }
public void StartDiscussionInitiation(StartDiscussionInitiationCommand command) { ApplicationServiceLifeCycle.Begin(); try { var product = this.productRepository.Get(new TenantId(command.TenantId), new ProductId(command.ProductId)); if (product == null) throw new InvalidOperationException( string.Format("Unknown product of tenant id: {0} and product id: {1}.", command.TenantId, command.ProductId)); var timedOutEventName = typeof(ProductDiscussionRequestTimedOut).Name; var tracker = new TimeConstrainedProcessTracker( tenantId: command.TenantId, processId: ProcessId.NewProcessId(), description: "Create discussion for product: " + product.Name, originalStartTime: DateTime.UtcNow, allowableDuration: 5L * 60L * 1000L, totalRetriesPermitted: 3, processTimedOutEventType: timedOutEventName); this.processTrackerRepository.Save(tracker); product.StartDiscussionInitiation(tracker.ProcessId.Id); this.productRepository.Save(product); ApplicationServiceLifeCycle.Success(); } catch (Exception ex) { ApplicationServiceLifeCycle.Fail(ex); } }