Exemplo n.º 1
0
 private FastContainer(FastContainer other)
 {
     this.registrations = new Dictionary <Type, FastContainerRegistration>();
     foreach (var otherRegistration in other.registrations)
     {
         this.registrations.Add(otherRegistration.Key, otherRegistration.Value.Clone());
     }
 }
Exemplo n.º 2
0
 public virtual object Resolve(FastContainer container)
 {
     AssertNotDisposed();
     if (this.instancePerCall)
     {
         return(this.resolve(container));
     }
     if (this.instance != null)
     {
         return(this.instance);
     }
     return(this.instance = this.resolve(container));
 }
Exemplo n.º 3
0
        private object[] ResolveParameters(ActionMethodDispatcher handler, object command, FastContainer childContainer)
        {
            var parameters = new object[handler.ParameterTypes.Count];

            for (int i = 0; i < parameters.Length; i++)
            {
                var parameterType = handler.ParameterTypes[i];
                if (parameterType == command.GetType())
                {
                    parameters[i] = command; // shortcut for command, it's a known type
                    continue;
                }
                parameters[i] = childContainer.Resolve(parameterType);
            }
            return(parameters);
        }
Exemplo n.º 4
0
 public CommandDispatcher(DispatchHandlers handlers, FastContainer iocContainer, Func <AdventureWorksDbContext> dbContextFactory)
 {
     this.handlers         = handlers;
     this.iocContainer     = iocContainer;
     this.dbContextFactory = dbContextFactory;
 }
Exemplo n.º 5
0
 public QueryDispatcher(DispatchHandlers handlers, FastContainer iocContainer)
 {
     this.handlers     = handlers;
     this.iocContainer = iocContainer;
 }