public IUnityContainer RegisterInstance(Type t, string name, object instance, LifetimeManager lifetime)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
if (lifetime == null)
{
throw new ArgumentNullException("lifetime");
}
if (!string.IsNullOrEmpty(name))
{
throw new NotSupportedException("Named registrations are not supported");
}
this.RegisteringInstance(this, new RegisterInstanceEventArgs(t, instance, name, lifetime));
lock (this.lockObj)
{
lifetime.SetValue(instance);
this.lifetimeTable.AddOrUpdate(t, lifetime);
this.factoryExpressionTable.AddOrUpdate(t, Expression.Constant(instance));
this.ClearBuildPlans();
}
return this;
}