Created
July 15, 2014 16:43
-
-
Save alexandrnikitin/9799e871bbcd573fc20b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Autofac; | |
using Xunit; | |
namespace ClassLibrary1 | |
{ | |
public class Stackoverflow24762539 | |
{ | |
[Fact] | |
public void Repro() | |
{ | |
var builder = new ContainerBuilder(); | |
builder.RegisterType<UnitOfWork>().InstancePerLifetimeScope(); | |
using (var container = builder.Build()) | |
{ | |
using (var lifetimeScope = container.BeginLifetimeScope(b => b.RegisterInstance(new PrincipalFactory()))) | |
{ | |
var unitOfWork = lifetimeScope.Resolve<UnitOfWork>(); | |
Assert.NotNull(unitOfWork); | |
} | |
} | |
} | |
} | |
public class UnitOfWork | |
{ | |
private readonly PrincipalFactory _principalFactory; | |
public UnitOfWork(PrincipalFactory principalFactory) | |
{ | |
_principalFactory = principalFactory; | |
} | |
} | |
public class PrincipalFactory | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment