Question

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.

Was it helpful?

Solution

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>.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top