List <IObjectActivator> CreateArgumentActivators(IDbContext dbContext) { ParameterInfo[] parameters = this.ConstructorDescriptor.ConstructorInfo.GetParameters(); List <IObjectActivator> argumentActivators = new List <IObjectActivator>(parameters.Length); for (int i = 0; i < parameters.Length; i++) { IObjectActivator argumentActivator = null; ParameterInfo parameter = parameters[i]; if (this.ConstructorParameters.TryGetValue(parameter, out int ordinal)) { argumentActivator = new PrimitiveObjectActivator(parameter.ParameterType, ordinal); } else if (this.ConstructorComplexParameters.TryGetValue(parameter, out IObjectActivatorCreator argumentActivatorCreator)) { argumentActivator = argumentActivatorCreator.CreateObjectActivator(dbContext); } else { throw new UnbelievableException(); } argumentActivators.Add(argumentActivator); } return(argumentActivators); }
public IObjectActivator CreateObjectActivator(IDbContext dbContext) { PrimitiveObjectActivator activator = new PrimitiveObjectActivator(this.ObjectType, this.ReaderOrdinal); return(activator); }