Example #1
0
 public static void RegisterServiceTypesTo(this IServiceInstance @this, IServiceMap serviceMap)
 {
     foreach (var type in @this.GetServiceInstanceTypesToRegister())
     {
         serviceMap.Add(type, @this);
     }
 }
        SimpleServiceContainer(
            IServiceMap serviceMap,
            IEnumerable <IServiceProducer> services,
            IEnumerable <IGetTypesToResolve> additionalTypesToResolve
            )
        {
            this.serviceMap = serviceMap;

            serviceMap.Add(typeof(IServiceContainer), this);

            foreach (var instance in services.GetServiceInstances())
            {
                Debug.Assert(instance != null, "SimpleServiceContainer::Ctor: instance is null");

                instance.RegisterServiceTypesTo(serviceMap);
            }

            additionalTypesToResolve
            .GetTypesToResolve()
            // .Log(x => x.Name)
            .Exec(ResolveStatic);
        }