private void OnRegisterInstance(object sender, RegisterInstanceEventArgs e)
 {
     Context.RegisterNamedType(e.RegisteredType, e.Name);
     this.SetLifetimeManager(e.RegisteredType, e.Name, e.LifetimeManager);
     NamedTypeBuildKey identityKey = new NamedTypeBuildKey(e.RegisteredType, e.Name);
     Context.Policies.Set<IBuildKeyMappingPolicy>(new BuildKeyMappingPolicy(identityKey), identityKey);
     e.LifetimeManager.SetValue(e.Instance);
 }
        private void OnRegisterInstance(object sender, RegisterInstanceEventArgs e)
        {
            registeredNames.RegisterType(e.RegisteredType, e.Name);
            SetLifetimeManager(e.RegisteredType, e.Name, e.LifetimeManager);
            NamedTypeBuildKey identityKey = new NamedTypeBuildKey(e.RegisteredType, e.Name);

            policies.Set <IBuildKeyMappingPolicy>(new BuildKeyMappingPolicy(identityKey), identityKey);
            e.LifetimeManager.SetValue(e.Instance);
        }