PawelC
PawelC

Reputation: 1226

Dependencies in the project

I have .NET Core Web API project. In this project i have 5 other project(.Net Core Library Class):

My problem is that from the project CarMechanic.Model I can see the enum which is in the project CarMechanic.Core, unfortunately in the project CarMachanic.Core I do not see the models that are in the project CarMachanic.Model

CarMechanic.Model dependency enter image description here

CarMechanic.Core dependency enter image description here

When i have checked CarMechanic.Model in dependency then i have error:

This dependency can not be added because it will create a cyclic relationship

Screen in my AutoMapperProfile where i need import Car model from CarMechanic.Model enter image description here

I don't have any idea what is wrong and why CarMechanic.Model see enum from CarMechanic.Core, but CarMechanic.Core don't see model from other solution. I spent 4-5 hours looking for a solution and I still did not find it.

My repository with this app: https://github.com/PawelCyrklaf/car-mechanic-api

Upvotes: 0

Views: 512

Answers (1)

Robert Perry
Robert Perry

Reputation: 1956

I have a seperate "Enums" project for exactly this purpose. They're typically used by the Entities and Models, so need to be seperate to avoid the cyclic relationship problem you're getting

Upvotes: 1

Related Questions