0

I am aware of this and I think I also understand the difference between relational model and domain model. However, I think that objects like this:

public class SomeFact 
{
    public DimensionX DimensionX { get; set; }
    public DimensionY DimensionY { get; set; }
    public double SomeValue { get; set; }
}

are perfectly reasonable in a DDD world as well as a relational world (star schema, dimensional model). Here DimensionX and DimensionY are entities. You could deem the above class as value object, as it would not exist without neither entity. However, usually a value object is part of an entity. Can I force EF to create a corresponding table for the above class (without primary key)? I know I could introduce a fake primary key but this would mean that I lose the clustered index which may become important for other things.

Community
  • 1
  • 1
cs0815
  • 16,751
  • 45
  • 136
  • 299
  • No you can't, but this table could have a compound primary key `DimensionXId, DimensionYId `. Requiring a primary key isn't an EF peculiarity by the way. It's a foundation of the relational paradigm. – Gert Arnold Jan 19 '15 at 21:00
  • Thanks yeah thought about combined key like this. Note sure whether I agree that a table needs to have a primary key by definition (see for example fact table). – cs0815 Jan 19 '15 at 21:16

0 Answers0