Ejemplo n.º 1
0
        /// <summary>
        /// Gets the instance managed by the <see cref="SingletonLifetime"/>
        /// </summary>
        /// <param name="objectBuilder">An <see cref="IObjectBuilder"/> implementation.</param>
        /// <param name="resolutionInfo">The info about the actual resolution.</param>
        /// <param name="resolveType">The type info about the resolved type.</param>
        /// <returns>The lifetime managed object.</returns>
        public object GetInstance(IObjectBuilder objectBuilder, ResolutionInfo resolutionInfo, TypeInformation resolveType)
        {
            if (this.instance != null) return this.instance;
            lock (this.syncObject)
            {
                if (this.instance != null) return this.instance;
                this.instance = objectBuilder.BuildInstance(resolutionInfo, resolveType);
            }

            return this.instance;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the instance managed by the <see cref="TransientLifetime"/>
 /// </summary>
 /// <param name="objectBuilder">An <see cref="IObjectBuilder"/> implementation.</param>
 /// <param name="resolutionInfo">The info about the actual resolution.</param>
 /// <param name="resolveType">The type info about the resolved type.</param>
 /// <returns>The lifetime managed object.</returns>
 public object GetInstance(IObjectBuilder objectBuilder, ResolutionInfo resolutionInfo, TypeInformation resolveType)
 {
     return objectBuilder.BuildInstance(resolutionInfo, resolveType);
 }