1

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?

asked Jun 15, 2018 at 5:09

1 Answer 1

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.

answered Jun 15, 2018 at 5:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.