コード例 #1
0
        /// <summary>
        /// This method is called by the export strategy when attempting to locate an export
        /// </summary>
        /// <param name="creationDelegate"></param>
        /// <param name="injectionScope"></param>
        /// <param name="injectionContext"></param>
        /// <param name="exportStrategy"></param>
        /// <returns></returns>
        public object Locate(ExportActivationDelegate creationDelegate,
			IInjectionScope injectionScope,
			IInjectionContext injectionContext,
			IExportStrategy exportStrategy)
        {
            if (lifestyleContainer == null)
            {
                lifestyleContainer = LocateContainer(exportStrategy.OwningScope, injectionContext);
            }

            return lifestyleContainer.Locate(creationDelegate, injectionScope, injectionContext, exportStrategy);
        }
コード例 #2
0
 public void SetInstance(object instance)
 {
     Lifestyle = new InjectedInstanceLifestyle(instance);
 }
 public ConcreteClassInstantiationLookupServiceDecorator(IComponentLookup underlying, ILifestyle lifestyle)
 {
     this.underlying = underlying;
     this.lifestyle  = lifestyle;
 }
コード例 #4
0
        /// <summary>
        /// Dispose of this object
        /// </summary>
        /// <param name="dispose"></param>
        protected virtual void Dispose(bool dispose)
        {
            if (_disposed)
            {
                return;
            }

            if (dispose)
            {
                ILifestyle lifestyleTemp = _lifestyle;

                _lifestyle = null;

                if (lifestyleTemp != null)
                {
                    lifestyleTemp.Dispose();
                }

                _conditions = ImmutableArray<IExportCondition>.Empty;
                _enrichWithDelegates = ImmutableArray<EnrichWithDelegate>.Empty;

                _disposed = true;
            }
        }
コード例 #5
0
        /// <summary>
        /// Set the life cycle container for the strategy
        /// </summary>
        /// <param name="container"></param>
        public virtual IConfigurableExportStrategy SetLifestyleContainer(ILifestyle container)
        {
            if (_lifestyle == null)
            {
                _lifestyle = container;
            }

            return this;
        }
コード例 #6
0
 /// <summary>
 /// Set the life cycle container for the strategy
 /// </summary>
 /// <param name="container"></param>
 public virtual void SetLifestyleContainer(ILifestyle container)
 {
     if (_lifestyle == null)
     {
         _lifestyle = container;
     }
 }
コード例 #7
0
 public FluentImplementorOptions <T> Custom(ILifestyle lifestyle)
 {
     command.Lifestyle = lifestyle;
     return(parentOptions);
 }
コード例 #8
0
        private IComponentLookup BuildLookupService(bool enableImplicitClassInstantiation, ILifestyle defaultLifestyle)
        {
            var underlying = new LookupService(componentStore);

            if (enableImplicitClassInstantiation)
            {
                return(new ConcreteClassInstantiationLookupServiceDecorator(underlying, defaultLifestyle));
            }
            return(underlying);
        }
コード例 #9
0
 public static ILifestyle Custom(ILifestyle lifestyle)
 {
     return(lifestyle);
 }
 public ConcreteClassInstantiationLookupServiceDecorator(IComponentLookup underlying, ILifestyle lifestyle)
 {
     this.underlying = underlying;
     this.lifestyle = lifestyle;
 }
コード例 #11
0
 public IClientFactory InitializationLifeStyle(ILifestyle lifestyle)
 {
     _lifeStyle = lifestyle;
     return this;
 }