0

I have this conceptual model:

enter image description here

I generate my entities using EF 6.1.3:

enter image description here

How can I modify the relationship of the conceptual model to a correct generation?

Explaining..

  • Id(Department) -> DeptId(Seller): In Department can't only have a List of Sellers? BossId should represent a instance of Seller, not a List and an instance (as in the diagram). Each seller have only 1 boss.

  • BossId(Seller) -> Id(Seller): Entity framework creates a list of Departments in Seller.(It doesn't makes any sense)

  • Id(Product) -> SimilarId(Product) [Auto relationship]: How can I make a relationship of (*..*) [Many-to-Many]? Product(s) can have 0 or * similarProducts, so should represent a List.

developer033
  • 24,267
  • 8
  • 82
  • 108

1 Answers1

0

There are two primary items, which I see as:

  • Each seller has a Boss who is a seller within the department
  • Create link between product and similar products

For Boss of Seller, it sounds like you want a one-to-one relationship from Department to Seller to indicate who is the boss. This tutorial may help with that. Your current setup is a one-to-many which is why you have a list of departments in Seller that reflects the many Departments that a Seller is a boss for. This should resolve both the "Id(Department) -> DeptId(Seller)" and "BossId(Seller) -> Id(Seller)" parts of your question.

For Product to Similar Products, you need to create a many-to-many link as is shown in this SO answer. Keep in mind the comment about weird table and key names referencing this link to combat it.

Community
  • 1
  • 1
Martin Noreke
  • 4,066
  • 22
  • 34