コード例 #1
0
        // This constructor needs to be public. It is called using reflection.
        public ContainerControlledCollection(Container container)
        {
            this.container = container;

            this.producers =
                new LazyEx <InstanceProducer[]>(() => this.lazyProducers.Select(p => p.Value).ToArray());
        }
コード例 #2
0
        // This constructor is called when we're in 'flowing' mode, because in that case we need to set the
        // scope before forwarding the call to InstanceProducers.
        protected ContainerControlledCollection(
            Container container, ContainerControlledCollection <TService> definition)
        {
            this.container = container;

            // Reference the producers from the definition. This doesn't cause any new objects.
            this.lazyProducers = definition.lazyProducers;
            this.producers     = definition.producers;
        }
コード例 #3
0
 private static object VerifyCreatingProducer(LazyEx <InstanceProducer> lazy)
 {
     try
     {
         // We only check if the instance producer can be created. We don't verify building of the
         // expression. That will be done up the call stack.
         return(lazy.Value);
     }
     catch (Exception ex)
     {
         throw new InvalidOperationException(
                   StringResources.ConfigurationInvalidCreatingInstanceFailed(typeof(TService), ex),
                   ex);
     }
 }