Ejemplo n.º 1
0
        protected virtual IObjectContainer GetObjectContainer(Type objectKey, IDictionary items)
        {
            lock (objectKey) {
                var ctx = new ObjectContainerContext(objectKey, items: items)
                {
                    Namespace = this.globalObjectNamespace, ObjectService = this
                };
                this.OnObjectContainerGetting(ctx);
                var container = ctx.Container;

                if (container == null)
                {
                    if (this.globalObjectNamespace.TypedObjects.ContainsKey(objectKey))
                    {
                        var typedObject = this.globalObjectNamespace.TypedObjects[objectKey];
                        if (typedObject != null)
                        {
                            container = typedObject.Container;
                        }
                    }
                }

                ctx.Container = container;
                this.OnObjectContainerGetted(ctx);
                container = ctx.Container;

                return(container);
            }
        }
Ejemplo n.º 2
0
        protected virtual IObjectContainer GetObjectContainer(string objectKey, IDictionary items)
        {
            lock (objectKey) {
                var ctx = new ObjectContainerContext(objectKey, items: items)
                {
                    Namespace = this.globalObjectNamespace, ObjectService = this
                };
                this.OnObjectContainerGetting(ctx);
                var container = ctx.Container;

                if (container == null)
                {
                    this.globalObjectNamespace.ObjectAliases.TryGetValue(objectKey, out container);
                }

                ctx.Container = container;
                this.OnObjectContainerGetted(ctx);
                container = ctx.Container;

                return(container);
            }
        }