public override void Load()
 {
     base.Load();
     KernelInstance.Bind <IPrincipal, IPrincipal <IMember> >().To <ProjectPrincipal>().InRequestScope();
     KernelInstance.Bind <IMember>().To <WindowsMember>().When(r => Thread.CurrentPrincipal.Identity.GetType() == typeof(WindowsIdentity)).InRequestScope();
     KernelInstance.Bind <IMember>().To <ClaimMember>().When(r => Thread.CurrentPrincipal.Identity.GetType() == typeof(ClaimsIdentity)).InRequestScope();
 }
Beispiel #2
0
 private void BindAmbientObjects()
 {
     KernelInstance.Bind <IDependencyResolver>().To <NinjectDependencyResolver>().InSingletonScope();
     KernelInstance.Bind <IUnitOfWork, IDbUnitOfWork>().To <EntityFrameworkUnitOfWork>().InTransientScope();
     KernelInstance.Bind <DbContext>().To <ProjectContext>().InTransientScope().WithConstructorArgument("configuration", nameof(ProjectContext));
     KernelInstance.Bind <ProjectContext>().ToSelf().InTransientScope().WithConstructorArgument("configuration", nameof(ProjectContext));
     KernelInstance.Bind <ProjectFilesContext>().ToSelf().InTransientScope().WithConstructorArgument("configuration", nameof(ProjectFilesContext));
     KernelInstance.Bind <ILogger>().To <TraceLog>().InSingletonScope();
     KernelInstance.Bind <ICache>().To <InMemoryCache>().InSingletonScope();
     KernelInstance.Bind <IGuidProvider>().To <GuidProvider>().InSingletonScope();
     KernelInstance.Bind <IDateTimeProvider>().To <LocalDateTimeProvider>().InSingletonScope();
     KernelInstance.Bind <IDateTimeOffsetProvider>().To <LocalDateTimeOffsetProvider>().InSingletonScope();
     KernelInstance.Bind <AC>().ToSelf().InSingletonScope();
 }
Beispiel #3
0
        public override void Load()
        {
            KernelInstance.Bind <IBatteryInfo>()
            .To <BatteryInfo>();

            KernelInstance.Bind <IBatteryParameters>()
            .To <BatteryParameters>();

            KernelInstance.Bind <IBatteryParametersFactory>()
            .ToFactory()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryDetailPresenter>()
            .To <BatteryDetailPresenter>()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryDetail>()
            .To <BatteryDetail>()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryIcon>()
            .To <BatteryIcon>()
            .InSingletonScope()
            .WithConstructorArgument("batteryTemplate", Properties.Resources.BattLevel)
            .WithConstructorArgument("batteryLevelMask", new Rectangle(5, 10, 20, 10))
            .WithConstructorArgument("batteryOrientation", BatteryIcon.BatteryOrientation.HorizontalL)
            .WithPropertyValue("BatteryLevel", 0);

            KernelInstance.Bind <IBatteryDataRetriever>()
            .To <BatteryDataRetriever>()
            .InSingletonScope();

            KernelInstance.Bind <IRdpServerVirtualChannel>()
            .To <RdpServerVirtualChannel>()
            .InSingletonScope()
            .WithConstructorArgument("channelName", "BATTMON");

            KernelInstance.Bind <ILog>().ToMethod(context =>
                                                  LogManager.GetLogger(context.Request.Target.Member.ReflectedType));

            KernelInstance.Bind <System.Timers.Timer>()
            .ToSelf()
            .InSingletonScope()
            .WithPropertyValue("AutoReset", true)
            .WithPropertyValue("Interval", Properties.Settings.Default.PollingInterval * 1000.0);
        }
Beispiel #4
0
        public override void Load()
        {
            //Configure the log here because this section will
            //get called once on startup, before the ILog instance
            //gets created.
            //
            //The client will only log if there is a log4net.config
            //file in the same folder as the DLL.
            string path          = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
            string log4NetConfig = Path.Combine(path, Properties.Resources.Log4NetConfig);

            if (File.Exists(log4NetConfig))
            {
                XmlConfigurator.Configure(new FileInfo(log4NetConfig));
            }
            else
            {
                //No config file.  Turn logging off.
                Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
                hierarchy.Root.Level = Level.Off;
            }
            KernelInstance.Bind <IRdpClientVirtualChannel>()
            .To <RdpClientVirtualChannel>()
            .InSingletonScope()
            .WithConstructorArgument("channelName", "BATTMON");

            KernelInstance.Bind <IBatteryDataReporter>()
            .To <BatteryDataReporter>()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryDataCollector>()
            .To <Win32BatteryManagementObjectSearcher>()
            .InSingletonScope()
            .WithConstructorArgument("query", "SELECT * FROM Win32_Battery");

            KernelInstance.Bind <IBatteryInfoFactory>()
            .ToFactory()
            .InSingletonScope();

            KernelInstance.Bind <Program>()
            .ToSelf();

            KernelInstance.Bind <ILog>().ToMethod(context =>
                                                  LogManager.GetLogger(context.Request.Target.Member.ReflectedType));
        }
 public override void Load()
 {
     KernelInstance.Bind <IApplicationManager>().To <ApplicationManager>();
     KernelInstance.Bind <IUsuarioService>().To <UsuarioService>();
     KernelInstance.Bind <IMovimentacaoService>().To <MovimentacaoService>();
 }
Beispiel #6
0
 private void ConfigureBusinessLayerInfrastructure()
 {
     KernelInstance.Bind <IJsonConverter>().To <JsonConverter>().InSingletonScope();
 }
Beispiel #7
0
 private void BindRepositories()
 {
     KernelInstance.Bind <IBinaryMetaRepository>().To <BinaryMetaRepository>().InTransientScope();
     KernelInstance.Bind <IUserRepository>().To <UserRepository>().InTransientScope();
 }
 public override void Load()
 {
     base.Load();
     KernelInstance.Bind <IMember>().To <Member>().InTransientScope();
 }
 public override void Load()
 {
     KernelInstance.Unbind <IServiceProvider>();
     KernelInstance.Bind <IOptions <MvcOptions> >().To <OptionsManager <MvcOptions> >();
     KernelInstance.Bind <IOptions <AntiforgeryOptions> >().To <OptionsManager <AntiforgeryOptions> >();
 }