private FastContainer(FastContainer other) { this.registrations = new Dictionary <Type, FastContainerRegistration>(); foreach (var otherRegistration in other.registrations) { this.registrations.Add(otherRegistration.Key, otherRegistration.Value.Clone()); } }
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)); }
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); }
public CommandDispatcher(DispatchHandlers handlers, FastContainer iocContainer, Func <AdventureWorksDbContext> dbContextFactory) { this.handlers = handlers; this.iocContainer = iocContainer; this.dbContextFactory = dbContextFactory; }
public QueryDispatcher(DispatchHandlers handlers, FastContainer iocContainer) { this.handlers = handlers; this.iocContainer = iocContainer; }