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); } }
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))); }
public TextileMill(IResolutionRoot kernel) { _pointCreator = kernel.Get <IPointCreator>(); _vehicleManager = kernel.Get <IVehicleManager>(); _forkliftManager = kernel.Get <IForkliftManager>(); }
IFoo CreateFoo() { _resolutionRoot.Get <IFoo>(); }
public ISourceBlock <T> GetChangeEvent <T>() where T : IConfigObject { return(_resolutionRoot.Get <ISourceBlock <T> >()); }
public DbFactory(IResolutionRoot resolutionRoot) { _resolutionRoot = resolutionRoot; _factory = resolutionRoot.Get <INinjectDbFactory>(); }
/// <inheritdoc /> public T MakePage <T>() where T : Page { return(_resolutionRoot.Get <T>()); }
public ParkingFine(IResolutionRoot kernel) { _pointCreator = kernel.Get <IPointCreator>(); _vehicleManager = kernel.Get <IVehicleManager>(); _wreckerManager = kernel.Get <IWreckerManager>(); }
public IUnitOfWork Create() { return(_ninjectIoCContainer.Get <IUnitOfWork>()); }
private void OnStartup(object sender, StartupEventArgs e) { var mainWindow = container.Get <MainWindow>(); mainWindow.Show(); }
public static Func <string> GetLanguage(IResolutionRoot kernel) { return(() => kernel.Get <IIdentityService>().Language ?? TwoLetterISOLanguageName.Russian); }
public ClanMissionManager(IResolutionRoot kernel) { _clanCourtyard = kernel.Get <IClanCourtyard>(); }
public TQuery Create <TQuery>() where TQuery : IQuery { return(_resolutionRoot.Get <TQuery>()); }
/// <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)); }
public SomeTask CreateScheduledTaskNow() { return(_resolutionRoot.Get <SomeTask>(new NonRequestScopedParameter())); }
public static Func<string> GetLanguage(IResolutionRoot kernel) { return () => kernel.Get<IIdentityService>().Language ?? TwoLetterISOLanguageName.Russian; }
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)); }
public override T Create(Type objectType) { return(_serviceLocator.Get(objectType) as T); }
public IOtherDependency Create() { return(_resolver.Get <IOtherDependency>()); }
public FishingVillage(IResolutionRoot kernel) { _pointCreator = kernel.Get <IPointCreator>(); _vehicleManager = kernel.Get <IVehicleManager>(); _fishermanManager = kernel.Get <IFishermanManager>(); }
public object Resolve(Type serviceType) { return(_kernel.Get(serviceType)); }
public object GetService(Type type) { return(_resolver.Get(type, _microdotNinectScopParameter)); }
public ForkliftEventHandler(IResolutionRoot kernel) { _playerInfoManager = kernel.Get <IPlayerInfoManager>(); _workInfoManager = kernel.Get <IWorkInfoManager>(); }
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))); }
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; }
public ComplexClass(ServiceUser serviceUser, IResolutionRoot resRoot) { InjectedServiceUser = serviceUser; ResolvedServiceUser = resRoot.Get<ServiceUser>(); }