示例#1
0
        public static Product Create(Guid id, string name, int quantity, decimal cost, ProductCode productCode)
        {
            var product = new Product
            {
                Id       = id,
                Name     = name,
                Quantity = quantity,
                Created  = DateTime.Now,
                Modified = DateTime.Now,
                Active   = true,
                Cost     = cost,
                Code     = productCode
            };

            DomainEvents.Raise(new ProductCreated {
                Product = product
            });

            return(product);
        }
示例#2
0
 public static Product Create(string name, int quantity, decimal cost, ProductCode productCode)
 {
     return(Create(Guid.NewGuid(), name, quantity, cost, productCode));
 }