public static void Main()
var container = new Container();
x.For<SingletonConcreteType>().Singleton();
x.For<ISingleton>().Singleton().Use<SingletonTypeThatDependsOnNonSingleton>();
var instance1 = container.GetInstance<SingletonConcreteType>();
var instance2 = container.GetInstance<SingletonConcreteType>();
Console.WriteLine(instance1 == instance2);
Console.WriteLine(instance1.Id == instance2.Id);
var instance3 = container.GetInstance<ConcreteType>();
var instance4 = container.GetInstance<ConcreteType>();
Console.WriteLine(instance3.Id == instance4.Id);
Console.WriteLine(container.GetInstance<ISingleton>().Id == container.GetInstance<ISingleton>().Id);
public class SingletonConcreteType
public Guid Id = Guid.NewGuid();
public class ConcreteType
public Guid Id = Guid.NewGuid();
public interface ISingleton
public class SingletonTypeThatDependsOnNonSingleton : ISingleton
public Guid Id { get { return ct.Id; } }
public SingletonTypeThatDependsOnNonSingleton(ConcreteType c)