0

I need to extend my domain model: products may have different specifications. E.g. motherboard specs are different from monitor specs.

there are two entities:

public class Product {
    public Guid Id { get; set; }
    public Category Category { get; set; }

    // ..Price, Title, Manufacturer properties
}

where Category is

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; }
}

Is that a normal way to solve this I mean putting ICollection<String> Specs inside Category entity?

I'm using ASP.NET MVC & Raven DB.

4

1 に答える 1

2

一連の仕様が製品のカテゴリの一部である場合、これはおそらくそれをモデル化するための良い方法です。

ただし、仕様はおそらく単純な文字列ではなく、独自の概念である必要があります (特定の要件を知らなくてもそう言えます)。

したがって、ICollection<string>have の代わりにICollection<Specification>.

于 2013-01-22T11:38:11.483 に答える