Exemple #1
0
        public Product(
            TenantId tenantId,
            ProductId productId,
            ProductOwnerId productOwnerId,
            string name,
            string description,
            DiscussionAvailability discussionAvailability)
        {
            this.TenantId               = tenantId; // must precede productOwnerId for compare
            this.Description            = description;
            this.Discussion             = ProductDiscussion.FromAvailability(discussionAvailability);
            this.DiscussionInitiationId = null;
            this.Name           = name;
            this.ProductId      = productId;
            this.ProductOwnerId = productOwnerId; // TODO: validation currently missing

            DomainEventPublisher
            .Instance
            .Publish(new ProductCreated(
                         this.TenantId,
                         this.ProductId,
                         this.ProductOwnerId,
                         this.Name,
                         this.Description,
                         this.Discussion.Availability));
        }
 public ProductDiscussionInitiated(TenantId tenantId, ProductId productId, ProductDiscussion productDiscussion)
 {
     this.EventVersion      = 1;
     this.OccurredOn        = DateTime.Now;
     this.ProductDiscussion = productDiscussion;
     this.ProductId         = productId;
     this.TenantId          = tenantId;
 }
 public ProductDiscussionInitiated(TenantId tenantId, ProductId productId, ProductDiscussion productDiscussion)
 {
     this.EventVersion = 1;
     this.OccurredOn = DateTime.Now;
     this.ProductDiscussion = productDiscussion;
     this.ProductId = productId;
     this.TenantId = tenantId;
 }
Exemple #4
0
        public void FailDiscussionInitiation()
        {
            if (this.Discussion.Availability != DiscussionAvailability.Ready)
            {
                this.DiscussionInitiationId = null;

                this.Discussion = ProductDiscussion.FromAvailability(DiscussionAvailability.Failed);
            }
        }
Exemple #5
0
        public void RequestDiscussion(DiscussionAvailability discussionAvailability)
        {
            if (this.Discussion.Availability != DiscussionAvailability.Ready)
            {
                this.Discussion =
                    ProductDiscussion.FromAvailability(discussionAvailability);

                DomainEventPublisher
                .Instance
                .Publish(new ProductDiscussionRequested(
                             this.TenantId,
                             this.ProductId,
                             this.ProductOwnerId,
                             this.Name,
                             this.Description,
                             this.Discussion.Availability == DiscussionAvailability.Requested));
            }
        }
 public ProductDiscussion(ProductDiscussion productDiscussion)
     : this(productDiscussion.Descriptor, productDiscussion.Availability)
 {
 }
 public ProductDiscussion(ProductDiscussion productDiscussion)
     : this(productDiscussion.Descriptor, productDiscussion.Availability)
 {
 }