public void Configuration(IAppBuilder app) { AutoMapperConfiguration.Config(); app.CreatePerOwinContext(PulseContext.Create); app.CreatePerOwinContext <PulseUserManager>(PulseUserManager.Create); ConfigureOAuth(app); var config = new HttpConfiguration(); config.MapHttpAttributeRoutes(); config.EnableCors(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); config.DependencyResolver = new NinjectResolver(NinjectConfiguration.CreateKernel()); var json = config.Formatters.JsonFormatter; json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects; config.Formatters.Remove(config.Formatters.XmlFormatter); app.UseCors(CorsOptions.AllowAll); app.UseWebApi(config); }
static void Main() { NinjectConfiguration.Config(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new KioskSetting()); }
public void When_component_is_not_registered_it_should_not_be_retrievable() { var kernel = new StandardKernel(); var configuration = new NinjectConfiguration(kernel); IReplicant component; var success = configuration.TryGet(out component); success.Should().BeFalse(); component.Should().BeNull(); }
public void When_component_is_registered_it_should_be_retrievable() { var kernel = new StandardKernel(); kernel.Bind<IReplicant>().To<Nexus6>(); var configuration = new NinjectConfiguration(kernel); IReplicant component; var success = configuration.TryGet(out component); success.Should().BeTrue(); component.Should().NotBeNull(); component.Should().BeAssignableTo<IReplicant>(); }
public static void Main(string[] args) { AutoMapperConfiguration.Config(); NinjectConfiguration.Config(); #if DEBUG Process process = ResolverFactory.GetService <Process>(); process.Start(); Console.ReadKey(); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new SelfHostService() }; ServiceBase.Run(ServicesToRun); #endif }
public void When_component_is_registered_it_should_be_retrievable() { var kernel = new StandardKernel(); kernel.Bind <IReplicant>().To <Nexus6>(); var configuration = new NinjectConfiguration(kernel); IReplicant component; var success = configuration.TryGet(out component); success.Should().BeTrue(); component.Should().NotBeNull(); component.Should().BeAssignableTo <IReplicant>(); }
public static void Main(string[] args) { AutoMapperConfiguration.Config(); NinjectConfiguration.Config(); #if DEBUG using (Microsoft.Owin.Hosting.WebApp.Start <SignalRConfiguration>(SettingsConfigurationSignalR.DOMAIN_SERVER)) { Console.WriteLine("OwinServer Started...."); Console.ReadKey(); } #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new SelfHostService() }; ServiceBase.Run(ServicesToRun); #endif }
private void ConfigureOAuth(IAppBuilder app) { var authorizationProvider = NinjectConfiguration.GetInstance().Kernel.GetService <SimpleAuthorizationServerProvider>(); var refreshTokenProvider = NinjectConfiguration.GetInstance().Kernel.GetService <SimpleRefreshTokenProvider>(); var OAuthServerOptions = new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true, TokenEndpointPath = new PathString("/token"), AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(20), Provider = authorizationProvider, RefreshTokenProvider = refreshTokenProvider }; app.UseOAuthAuthorizationServer(OAuthServerOptions); app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); }
static void Main(string[] args) { NinjectConfiguration.Configure(); var kernel = NinjectConfiguration.GetInstance().Kernel; DbInitializer.Initialize(kernel.Get <IDbContext>()).Wait(); var inputGpio = kernel.Get <IGpioInputInterface>(); var inputManager = kernel.Get <IInputCircuitsManager>(); inputGpio.CircuitStateChanged = inputManager.HandleCircuitChange; LogHelper.LogMessage("Input GPIO: " + baseAddress); using (WebApp.Start <WebApiStartup>(url: baseAddress)) { LogHelper.LogMessage("Host started on: " + baseAddress); #if DEBUG while (true) { var message = Console.ReadLine(); if (!string.IsNullOrEmpty(message)) { var arguments = message.Split(':'); if (arguments.Count() == 2) { InputPin inputPin; bool state; var pinParsedSucessfull = Enum.TryParse(arguments[0], out inputPin); var stateParsedSucessfull = Boolean.TryParse(arguments[1], out state); if (pinParsedSucessfull && stateParsedSucessfull) { inputGpio.CircuitStateChanged(state, inputPin); } } } } #else Console.ReadLine(); #endif } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += (sender, args) => { var result = DialogResult.Cancel; MessageBox.Show(args.Exception.Message, "Opps", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); if (result == DialogResult.Abort) { Application.Exit(); } }; _kernel = NinjectConfiguration.GetKernel(); var mainForm = _kernel.Get <MainForm>(); Application.Run(mainForm); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); NinjectConfiguration.Configure(); AutoMapperConfiguration.Configure(); KillSwitch.Instance = new AppSettingsKillSwitch(); DataLoadResults.Instance = DataLoadResultImplementation.GetRVCDataLoadResultInstance(); DBConnectionStatusImplementation.RegisterImplementations(); AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.UserToken; OldContextSynchronizationSwitch.Instance = new AppSettingsOldContextSynchronization(); ConfigureViewEngines(); HttpConfiguration(); Reporting.Configuration.ConfigureReporting(GlobalConfiguration.Configuration.DependencyResolver); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); MvcContext = Context; Application["context"] = Context; Application["appInstance"] = Context.ApplicationInstance; }
private ServiceResolver() { _kernal = NinjectConfiguration.InitKernal(); }
public Startup(IKernel kernel = null) { _Kernel = kernel ?? (_DisposableKernel = NinjectConfiguration.CreateDefaultKernel()); }
public ViewModelLocator() { _kernel = NinjectConfiguration.LoadKernel(); }