My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CircularDependencies  
Circular dependencies are mutual runtime dependencies between components.
Updated Aug 6, 2010 by nicholas...@gmail.com

Introduction

Constructor/property dependencies

Register the class that has the property dependency with the InjectUnsetProperties handler on Activated, e.g.:

class DependsByCtor
{
  public DependsByCtor(DependsByProp dependency) { }
}

class DependsByProp
{
  public DependsByCtor Dependency { get; set; }
}

// ...

var cb = new ContainerBuilder();
cb.Register<DependsByCtor>();
cb.Register<DependsByProp>().OnActivated(ActivatedHandler.InjectUnsetProperties);

Note, it doesn't make sense to set up this scenario if both classes are registered with Factory scope.

Constructor/constructor dependencies

Not handled - integration of DynamicProxy should do the trick though (post to the newsgroup if you're interested in trying.)

Comment by project member nicholas...@gmail.com, Nov 16, 2007

In version 1.0.2 and later (not released at time of writing.)

Comment by neuro.potent, Mar 7, 2011

What about property/property dependencies which are not SingleInstance?()-ed? I know this doesn't make much sense from Autofac's standpoint but what are some ways to do it?


Sign in to add a comment
Powered by Google Project Hosting