Ejemplo 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());
     }
 }
Ejemplo 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));
 }
Ejemplo 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);
        }
Ejemplo n.º 4
0
 public CommandDispatcher(DispatchHandlers handlers, FastContainer iocContainer, Func <AdventureWorksDbContext> dbContextFactory)
 {
     this.handlers         = handlers;
     this.iocContainer     = iocContainer;
     this.dbContextFactory = dbContextFactory;
 }
Ejemplo n.º 5
0
 public QueryDispatcher(DispatchHandlers handlers, FastContainer iocContainer)
 {
     this.handlers     = handlers;
     this.iocContainer = iocContainer;
 }