示例#1
0
        public override object CreateOrGetInstance(object[] args)
        {
            object instance = this.Factory.CreateInstance(this.Type, args);

            InstanceCreatedEventArgs arg = new InstanceCreatedEventArgs();

            arg.Instance     = instance;
            arg.InstanceType = this.Type;

            OnInstanceCreated(arg);

            return(instance);
        }
示例#2
0
        public override object CreateOrGetInstance(object[] args)
        {
            if (this.Instance == null)
            {
                lock (_instancelock)
                {
                    if (this.Instance == null)
                    {
                        this.Instance = this.Factory.CreateInstance(this.Type, args);

                        InstanceCreatedEventArgs arg = new InstanceCreatedEventArgs();
                        arg.Instance     = this.Instance;
                        arg.InstanceType = this.Type;

                        OnInstanceCreated(arg);
                    }
                }
            }

            return(this.Instance);
        }
示例#3
0
 protected virtual void OnInstanceCreated(InstanceCreatedEventArgs e)
 {
     this.InjectionStrategy.ChainAutoInjectors().Inject(e.Instance);
 }