public object Resolve(IResolutionRoot resolutionRoot, IResolutionParameters resolutionParameters)
        {
            Type type = resolutionParameters.TypeToResolve;
            TypeInfo typeInfo = type.GetTypeInfo();

            if (typeInfo.IsGenericType)
            {
                var genericType = type.GetGenericTypeDefinition();
                if (genericType == typeof(IEnumerable<>) ||
                    genericType == typeof(ICollection<>) ||
                    genericType == typeof(IList<>) ||
                    genericType == typeof(List<>))
                {
                    return this.GetAllAsList(resolutionRoot, typeInfo.GenericTypeArguments[0], resolutionParameters);
                }
            }

            if (typeInfo.IsArray)
            {
                var argumentType = type.GetElementType();
                return this.GetAllAsArray(resolutionRoot, argumentType, resolutionParameters);
            }

            return resolutionRoot.Get(
                type,
                resolutionParameters.Constraint,
                resolutionParameters.Parameters.ToArray());
        }
            public NinjectServiceScope(
                IResolutionRoot resolver,
                IEnumerable<IParameter> inheritedParameters)
            {
                _scope = new ScopeParameter();
                inheritedParameters = inheritedParameters.AddOrReplaceScopeParameter(_scope);
                _serviceProvider = new NinjectServiceProvider(resolver, inheritedParameters.ToArray());

                var httpContext = resolver.Get<IHttpContextAccessor>().HttpContext;

                if (httpContext != null)
                {
                    httpContext.Items.Add(typeof(ScopeParameter).FullName, _scope);
                }
            }
Esempio n. 3
0
        private void SubscribeAllObservers(IResolutionRoot container)
        {
            var notificationService = container.Get <INotificationService>();

            var emailSettingsService = container.Get <ISettingsService <EmailNotificationSettings> >();
            var emailSettings        = emailSettingsService.GetSettings();

            SubScribeOvserver(emailSettings, notificationService, new EmailMessageNotification(emailSettingsService));


            var pushbulletService  = container.Get <ISettingsService <PushbulletNotificationSettings> >();
            var pushbulletSettings = pushbulletService.GetSettings();

            SubScribeOvserver(pushbulletSettings, notificationService, new PushbulletNotification(container.Get <IPushbulletApi>(), pushbulletService));


            var pushoverService  = container.Get <ISettingsService <PushoverNotificationSettings> >();
            var pushoverSettings = pushoverService.GetSettings();

            SubScribeOvserver(pushoverSettings, notificationService, new PushoverNotification(container.Get <IPushoverApi>(), pushoverService));

            var slackService  = container.Get <ISettingsService <SlackNotificationSettings> >();
            var slackSettings = slackService.GetSettings();

            SubScribeOvserver(slackSettings, notificationService, new SlackNotification(container.Get <ISlackApi>(), slackService));

            var mattermostService  = container.Get <ISettingsService <MattermostNotificationSettings> >();
            var mattermostSettings = mattermostService.GetSettings();

            SubScribeOvserver(mattermostSettings, notificationService, new MattermostNotification(container.Get <IMattermostApi>(), mattermostService));

            var discordSettings = container.Get <ISettingsService <DiscordNotificationSettings> >();
            var discordService  = discordSettings.GetSettings();

            SubScribeOvserver(discordService, notificationService, new DiscordNotification(container.Get <IDiscordApi>(), discordSettings));
        }
        /// <summary>
        /// Creates a <see cref="IBuildProvider" />.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <returns>
        /// A <see cref="IBuildProvider" />.
        /// </returns>
        public IBuildProvider Create(ConnectionSettings settings)
        {
            Ensure.That(settings).IsNotNull();

            return(_resolutionRoot.Get <T2>(new ConstructorArgument(nameof(settings), settings, true)));
        }
Esempio n. 5
0
 public TextileMill(IResolutionRoot kernel)
 {
     _pointCreator    = kernel.Get <IPointCreator>();
     _vehicleManager  = kernel.Get <IVehicleManager>();
     _forkliftManager = kernel.Get <IForkliftManager>();
 }
Esempio n. 6
0
 IFoo CreateFoo()
 {
     _resolutionRoot.Get <IFoo>();
 }
Esempio n. 7
0
 public ISourceBlock <T> GetChangeEvent <T>() where T : IConfigObject
 {
     return(_resolutionRoot.Get <ISourceBlock <T> >());
 }
 public DbFactory(IResolutionRoot resolutionRoot)
 {
     _resolutionRoot = resolutionRoot;
     _factory        = resolutionRoot.Get <INinjectDbFactory>();
 }
Esempio n. 9
0
 /// <inheritdoc />
 public T MakePage <T>() where T : Page
 {
     return(_resolutionRoot.Get <T>());
 }
Esempio n. 10
0
 public ParkingFine(IResolutionRoot kernel)
 {
     _pointCreator   = kernel.Get <IPointCreator>();
     _vehicleManager = kernel.Get <IVehicleManager>();
     _wreckerManager = kernel.Get <IWreckerManager>();
 }
Esempio n. 11
0
 public IUnitOfWork Create()
 {
     return(_ninjectIoCContainer.Get <IUnitOfWork>());
 }
Esempio n. 12
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            var mainWindow = container.Get <MainWindow>();

            mainWindow.Show();
        }
Esempio n. 13
0
 public static Func <string> GetLanguage(IResolutionRoot kernel)
 {
     return(() => kernel.Get <IIdentityService>().Language
            ?? TwoLetterISOLanguageName.Russian);
 }
 public ClanMissionManager(IResolutionRoot kernel)
 {
     _clanCourtyard = kernel.Get <IClanCourtyard>();
 }
Esempio n. 15
0
 public TQuery Create <TQuery>() where TQuery : IQuery
 {
     return(_resolutionRoot.Get <TQuery>());
 }
Esempio n. 16
0
 /// <summary>
 /// Gets a node by the specified type.
 /// </summary>
 /// <param name="type">Type of the node to return.</param>
 /// <returns>The first node matching the TNode type.</returns>
 public override INode <T> GetNode <T>(Type type)
 {
     return((INode <T>)_resolver.Get(type));
 }
Esempio n. 17
0
 public SomeTask CreateScheduledTaskNow()
 {
     return(_resolutionRoot.Get <SomeTask>(new NonRequestScopedParameter()));
 }
Esempio n. 18
0
		public static Func<string> GetLanguage(IResolutionRoot kernel)
		{
			return () => kernel.Get<IIdentityService>().Language
						 ?? TwoLetterISOLanguageName.Russian;
		}
Esempio n. 19
0
 public object Build(Type typeToBuild)
 {
     return(resolutionRoot.Get(typeToBuild));
 }
 public BusDriverManager(IResolutionRoot kernel)
 {
     _playerInfoManager = kernel.Get <IPlayerInfoManager>();
     _workInfoManager   = kernel.Get <IWorkInfoManager>();
 }
 public T Get <T>()
 {
     return(_resolutionRoot.Get <T>());
 }
 public IJob NewJob(TriggerFiredBundle bundle, Quartz.IScheduler scheduler)
 {
     return((IJob)_resolutionRoot.Get(bundle.JobDetail.JobType));
 }
Esempio n. 23
0
 public override T Create(Type objectType)
 {
     return(_serviceLocator.Get(objectType) as T);
 }
Esempio n. 24
0
 public IOtherDependency Create()
 {
     return(_resolver.Get <IOtherDependency>());
 }
Esempio n. 25
0
 public FishingVillage(IResolutionRoot kernel)
 {
     _pointCreator     = kernel.Get <IPointCreator>();
     _vehicleManager   = kernel.Get <IVehicleManager>();
     _fishermanManager = kernel.Get <IFishermanManager>();
 }
Esempio n. 26
0
 public object Resolve(Type serviceType)
 {
     return(_kernel.Get(serviceType));
 }
 public object GetService(Type type)
 {
     return(_resolver.Get(type, _microdotNinectScopParameter));
 }
Esempio n. 28
0
 public ForkliftEventHandler(IResolutionRoot kernel)
 {
     _playerInfoManager = kernel.Get <IPlayerInfoManager>();
     _workInfoManager   = kernel.Get <IWorkInfoManager>();
 }
Esempio n. 29
0
 public VehicleTheft(IResolutionRoot kernel) : base(kernel.Get <IPlayerInfoManager>(), kernel.Get <IClanManager>())
 {
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public object Create(Type type)
 {
     return(resolver.Get(type));
 }
 /// <summary>
 /// Creates a named scope with the specified name.
 /// </summary>
 /// <param name="resolutionRoot">The resolution root.</param>
 /// <param name="scopeName">The name of the scope.</param>
 /// <returns>A resolution root that represents the specified scope.</returns>
 public static NamedScope CreateNamedScope(this IResolutionRoot resolutionRoot, string scopeName)
 {
     return(resolutionRoot.Get <NamedScope>(new NamedScopeParameter(scopeName)));
 }
Esempio n. 32
0
 public TuningGarage(IResolutionRoot kernel)
 {
     _pointCreator       = kernel.Get <IPointCreator>();
     _playerInfoManager  = kernel.Get <IPlayerInfoManager>();
     _vehicleInfoManager = kernel.Get <IVehicleInfoManager>();
 }
        public static void DisableHttps(this IResolutionRoot resolutionRoot)
        {
            DiscoveryConfig getDiscoveryConfig = resolutionRoot.Get <Func <DiscoveryConfig> >()();

            getDiscoveryConfig.Services["SlowService"].UseHttpsOverride = false;
        }
Esempio n. 34
0
 public ComplexClass(ServiceUser serviceUser, IResolutionRoot resRoot)
 {
     InjectedServiceUser = serviceUser;
     ResolvedServiceUser = resRoot.Get<ServiceUser>();
 }