@@ -26,14 +26,9 @@ public sealed class ProductCategory
2626
2727 #region Constructors
2828
29- private ProductCategory ( ) : base ( Guid . Empty )
30- {
31- Name = string . Empty ;
32- Description = string . Empty ;
33- Code = string . Empty ;
34- IsActive = false ;
35- CompanyId = Guid . Empty ;
36- }
29+ #pragma warning disable CS8618 , CA1823
30+ private ProductCategory ( ) : base ( Guid . Empty ) { }
31+ #pragma warning restore CS8618 , CA1823
3732
3833 private ProductCategory (
3934 string name ,
@@ -64,10 +59,9 @@ public static ProductCategory Create(
6459 if ( string . IsNullOrWhiteSpace ( code ) )
6560 throw new ProductCategoryCodeNullException ( CategoryErrors . CodeEmpty ) ;
6661
67- if ( companyId == Guid . Empty )
68- throw new IdentifierNullException ( CompanyErrors . Invalid ) ;
69-
70- return new ProductCategory ( name , description , code , companyId ) ;
62+ return companyId == Guid . Empty
63+ ? throw new IdentifierNullException ( CompanyErrors . Invalid )
64+ : new ProductCategory ( name , description , code , companyId ) ;
7165 }
7266
7367 #endregion
@@ -80,12 +74,12 @@ public void UpdateDetails(string name, string? description)
8074 throw new ProductCategoryNameNullException ( CategoryErrors . NameEmpty ) ;
8175
8276 Name = name ;
83- if ( description is not null )
77+ if ( description is not null )
8478 Description = description ;
8579 }
8680
8781 public void Activate ( ) => IsActive = true ;
8882 public void Deactivate ( ) => IsActive = false ;
8983
9084 #endregion
91- }
85+ }
0 commit comments