mercredi 13 octobre 2021

How can extract one class from repository to call her in the others classes of the repository layer?

in my job I'm use CQRS pattern and in the repository layer I have a issue related with a circular reference, I explain: I have a one class called Profile, this class validate some stuffs related with the user in my application and this class is in the repository layer, now, this class is called in the other classes from repository, for example

public class Repository1 { public Repository1 (..., IProfile profile) }
public class Repository2 { public Repository2 (..., IProfile profile) }

but, when I invoked Repository1 or Repository2 in Profile class, a circular reference is generated.

My question is, how can extract Profile class to invoked her in other classes from repository?

One dependency is that Profile class is connected to data origin.

I think I could be misusing the repository pattern and the classes in this layer, they cannot invoke each other.

Aucun commentaire:

Enregistrer un commentaire