![](/img/trans.png)
[英]Find products by specifications with Amazon Product Advertising API
[英]Representing product specifications
我需要擴展我的域模型:產品可能具有不同的規格。 例如,主板規格與顯示器規格不同。
有兩個實體:
public class Product {
public Guid Id { get; set; }
public Category Category { get; set; }
// ..Price, Title, Manufacturer properties
}
Category
在哪里
public class Category {
// ..ctor to initialize this.Specs as List or as Dictionary
public Guid Id { get; set; }
public String Title { get; set; }
public ICollection<String> Specs { get; set; }
}
這是解決此問題的一種正常方法,我的意思是將ICollection<String> Specs
放入Category
實體中?
我正在使用ASP.NET MVC
和Raven DB
。
如果一組規格是產品類別的一部分,那么這可能是對它進行建模的好方法。
不過,規范可能應該是其自己的概念,而不是簡單的字符串(我說這對您的特定要求一無所知)。
因此,可以使用ICollection<Specification>
代替ICollection<string>
ICollection<Specification>
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.