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.

svick
  • 236,525
  • 50
  • 385
  • 514
lexeme
  • 2,915
  • 10
  • 60
  • 125

1 Answers1

2

If a set of specifications is part of a category of products then this is probably a good way to model it.

Though, a specification should probably be its own concept rather than a simple string (I say that without any knowledge of your specific requirements).

So, instead of an ICollection<string> have an ICollection<Specification>.

Oded
  • 489,969
  • 99
  • 883
  • 1,009