Skip to content

Instantly share code, notes, and snippets.

@alexandrnikitin
Created July 15, 2014 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexandrnikitin/9799e871bbcd573fc20b to your computer and use it in GitHub Desktop.
Save alexandrnikitin/9799e871bbcd573fc20b to your computer and use it in GitHub Desktop.
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