/// <summary> /// /// </summary> /// <param name="config"></param> public StandardResolver(IResolverConfig config) { if (config == null) { throw new ArgumentNullException("config"); } bindingsFactory = CreateBindings; instanceFactory = CreateInstance; Components = config.CreateComponentContainer(); metadataFactory = Components.Get <IMetadataFactory>(); processors = Components.GetAll <IProcessor>().ToArray(); injectors = Components.GetAll <IInjector>().ToArray(); handlers = Components.GetAll <IMissingHandler>().ToArray(); foreach (var group in config.CreateBindings(Components).GroupBy(b => b.Type)) { table.Add(group.Key, group.ToArray()); } var selfType = typeof(IResolver); table.Add(selfType, new IBinding[] { new Binding(selfType, new ConstantProvider <IResolver>(this), null, null, null, null) }); }
public static StandardResolver ToResolver(this IResolverConfig config) { return(new StandardResolver(config)); }