Milad Rashidi
Milad Rashidi

Reputation: 1366

Autofac IOC: Why circular dependency between services detected in runtime?

I'm using Autofac IOC in my Asp.Net MVC Application. I have seen a circular dependency between services detected in run time (even not detected in building/rebuilding project). Why this happen in run time?

Upvotes: 0

Views: 143

Answers (1)

Steven
Steven

Reputation: 172646

Autofac is not a compiler or compiler plugin. It is a library that uses reflection to gather information only available at runtime to build object graphs, and it only does so when you start your application.

If you want compiler support: don't use a DI Container, but revert to using Pure DI, which means you build your object graphs by hand (using new statements) inside the Composition Root.

Upvotes: 1

Related Questions