I have a .NET application (actually this can be a problem for any N-Tiered application) which has 3 separate components.

  • ClassLibrary
    • Has Cross Cutting Concerns like logging, authentication and IoC resolving.
    • Has static Utility classes for Encoding/Decoding, Encryption etc.
  • ThirdPartyApps
    • Has external library references like YouTube, Azure, AWS nuget packages and libraries.
    • References to ClassLibrary to use logging and static utility classes.
  • Background Application
    • Also references to Class Library.
    • Includes logic to utilize ThirdParty Apps, such as consuming YoutubeAPI

My problem in here, from Background Application, I do not want do direct reference to ThirdPartyApps. Because, I want ClassLibrary to resolve provider I want (from ThirdPartyApps).

But I cannot register ThirdPartyApps in ClassLibrary with Autofac (IoC container), because ClassLibrary already referenced by ThirdPartyApps, so it will create "Circular Dependency Error".

Seems like I am missing an implementation logic here, and would like to see what would be a possible way to resolve it.

I am thinking to create another component for dependency mapping, but I do not want to create unnecessary extra component for no reason (or maybe this will be the solution?).

Is there any wrong logic I am missing here?

1 Answer 1


(or maybe this will be the solution?)"

Yes, go and create another component, of course. And that component is not unnecessary. If you don't want to create a "big ball of mud", where everything depends on everything else, you will be happy that you don't need to bind your existing ClassLibrary to the ThirdPartyApps component directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.