Mam następującą klasę Product
public class Product
{
public string ProductName { get; set; }
public string Category { get; set; }
public string SubCategory { get; set; }
public string Components { get; set; }
public List<decimal> Price { get; set; }
public List<double> Size { get; set; }
public double? Weight { get; set; }
public bool IsInLocal { get; set; }
public bool IsOnline { get; set; }
}
Mam ViewModel SelectAdditionalComponentsViewModel, który m.in. zawiera właściwości ProductName, Components , Price.
Mam również ViewModel BasketViewModel, który przedstawia się następująco
public class BasketViewModel
{
public List<Product> Products { get; set; }
public decimal OrderPrice { get; set; }
public class Product
{
public string ProductName { get; set; }
public string ProductComponents { get; set; }
public string AdditionalComponents { get; set; }
public double? Size { get; set; }
public double? Weight { get; set; }
public decimal ProductPrice { get; set; }
}
}
Mam jeszcze inne View Modele, które mają niektóre właściwości takie jak w klasie Product.
Jak widać właściwości z klasy Product w pewnej części powielane są w kilku view modelach.
Jak w takim przypadku powinny wyglądać View modele? Czy każdy ViewModel powinien mieć swoje właściwości, bez względu na to, czy takowe już istnieją, czy może taki ViewModel powinien dziedziczyć po klasie Product, z tym, że wówczas niektóre właściwości bezużyteczne?