autofac / Autofac

An addictive .NET IoC container
https://autofac.org
MIT License
4.47k stars 836 forks source link

AutofacDomainServiceFactory creates instances in the root container #303

Closed alexmg closed 10 years ago

alexmg commented 10 years ago

From nicholas...@gmail.com on March 01, 2011 07:29:36

The constructor of AutofacDomainServiceFactory() in the RIA Services integration takes an IContainer in its constructor. Because it creates instances directly through the container, these are all singletons or else leaked through the root container.

As a workaround, it is possible to create ADSF with a ContainerProviderContainer:

var dsf = new AutofacDomainServiceFactory( new ContainerProviderContainer(_containerProvider));

To fix the problem, ADSF must accept only an IContainerProvider as its constructor parameter, and use the request lifetime appropriately.

(An additional challenge will be to make this work with the new MVC3 integration, which does not use IContainerProvider.)

Carl: please assign this back to me if you're unable to take a look at this - thanks! :)

Original issue: http://code.google.com/p/autofac/issues/detail?id=303

alexmg commented 10 years ago

From travis.illig on September 21, 2012 09:31:36

Labels: Module-Extras-DomainServices

alexmg commented 10 years ago

From travis.illig on December 03, 2012 17:28:31

I'll take this for the Autofac 3 release.

Status: Started
Owner: travis.illig
Cc: carl.hoerberg

alexmg commented 10 years ago

From travis.illig on December 03, 2012 17:32:33

This issue was closed by revision 8ed06b4c6f19 .

Status: Fixed