C
C#2mo ago
alperenk._

Circular Dependency

I encounter a error message. Does it try to create IproductRepository interface before Helmetservice ? I dont know. Here is the full error message;
No description
No description
5 Replies
alperenk._
alperenk._2mo ago
this is the full error message
Pobiega
Pobiega2mo ago
show the constructor for HelmetService
alperenk._
alperenk._2mo ago
public HelmetService(IProductRepository productRepository) { this.productRepository = productRepository; }
Pobiega
Pobiega2mo ago
yeah so uh You are registering HelmetService to be resolved as your IProductRepository you then also try to inject an IProductRepository into HelmetService. This is a circular reference. ie, helmetservice is requesting itself
alperenk._
alperenk._2mo ago
oh