コード例 #1
0
ファイル: Product.cs プロジェクト: nardir/DDD.Sandbox
        protected Product(ProductGroup productGroup, string name, decimal?listPrice, string description) : this()
        {
            if (productGroup == null)
            {
                throw new ArgumentNullException(nameof(productGroup));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            ProductGroup = productGroup;
            Name         = name;
            ListPrice    = listPrice;
            DateCreated  = DateTime.Now;
            Description  = description;
        }
コード例 #2
0
ファイル: Product.cs プロジェクト: nardir/DDD.Sandbox
 public static Product Create(ProductGroup productGroup, string name, decimal?listPrice, string description)
 {
     return(new Product(productGroup, name, listPrice, description));
 }