Exemplo n.º 1
0
 public static void SetServiceLocator(Func <IAppServiceLocator> create)
 {
     if (create == null)
     {
         throw new ArgumentNullException("create");
     }
     Current = create();
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="ApplicationServiceManager" /> class.
        /// </summary>
        /// <param name="serviceLocator">Implementation used to find all registered services.</param>
        /// <exception cref="System.ArgumentNullException">container</exception>
        public ApplicationServiceManager(IAppServiceLocator serviceLocator)
        {
            if (serviceLocator == null)
            {
                throw new ArgumentNullException("serviceLocator");
            }

            _serviceLocator = serviceLocator;
            CheckInterval   = TimeSpan.FromSeconds(30);
            StartInterval   = TimeSpan.FromSeconds(5);
            _timer          = new Timer(OnCheckServices, null, Timeout.Infinite, Timeout.Infinite);
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="ApplicationServiceManager" /> class.
        /// </summary>
        /// <param name="container">Inversion of control container (griffin adapter to support all containers).</param>
        /// <exception cref="System.ArgumentNullException">container</exception>
        public ApplicationServiceManager(IContainer container)
        {
            if (container == null) throw new ArgumentNullException("container");

            _serviceLocator = new IocAppServiceLocator(container);
            CheckInterval = TimeSpan.FromSeconds(30);
            StartInterval = TimeSpan.FromSeconds(5);
            _timer = new Timer(OnCheckServices, null, Timeout.Infinite, Timeout.Infinite);
        }
Exemplo n.º 4
0
 public BaseController()
 {
     AppServiceLocator = ServiceProviderFactory.CreateServiceProvider();
 }