public static IKernel Init() { if (Current != null) { return Current; } Current = new StandardKernel(); if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["FakeDB"]) == false) { Current.Bind<IQuestionRepository>().To<FakeQuestionRepository>(); } else if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["mongodb:connectionString"]) == false) { Current.Bind<IQuestionRepository>().To<MongoDBQuestionRepository>(); } else { Current.Bind<IQuestionRepository>().To<DBQuestionRepository>(); } Current.Bind<IMailService>().To<MailService>(); return Current; }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { // Load BusinessLogic plugin kernel.Bind<ISiteManager>().To<SiteManager>(); kernel.Bind<ISupplierManager>().To<SupplierManager>(); kernel.Bind<IProductManager>().To<ProductManager>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<ICrowdSourcedNewsDbContext>().To<CrowdSourcedNewsDbContext>().InRequestScope(); kernel.Bind(typeof(IPubnubBroadcaster)).To<PubnubBroadcaster>(); kernel.Bind(typeof(IRepository<>)).To(typeof(EfGenericRepository<>)); kernel.Bind(x => x.From(Assemblies.DataServices).SelectAllClasses().BindDefaultInterface()); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IBadgeRepository>().To<SqlBadgeRepository>(); kernel.Bind<IPostRepository>().To<SqlPostRepository>(); kernel.Bind<ITagRepository>().To<SqlTagRepository>(); kernel.Bind<IUserRepository>().To<SqlUserRepository>(); }
private static void RegisterServices(IKernel kernel) { kernel.Bind<IRestClient>().To<RestClient>(); kernel.Bind<IWeatherAggregatorService>().To<WeatherAggregatorService>(); kernel.Bind<IWeatherService>().To<AccuWeatherService>().WithConstructorArgument("apiUrl", ApiConfig.AccuWeatherApiUrl); kernel.Bind<IWeatherService>().To<BbcWeatherService>().WithConstructorArgument("apiUrl", ApiConfig.BbcWeatherApiUrl); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { var types = AutoMapperConfig.GetTypesInAssembly(); var config = AutoMapperConfig.ConfigureAutomapper(types); var mapper = config.CreateMapper(); kernel.Bind<MapperConfiguration>().ToMethod(c => config).InSingletonScope(); kernel.Bind<IMapper>().ToConstant(mapper); kernel.Bind(typeof(IRepository<>)).To(typeof(EfGenericRepository<>)); kernel.Bind<IDiagnoseMeDbContext>().To<DiagnoseMeDbContext>().InRequestScope(); kernel.Bind( b => b.From(Assemblies.DataServices) .SelectAllClasses() .BindDefaultInterface()); kernel.Bind( b => b.From(Assemblies.WebServices) .SelectAllClasses() .BindDefaultInterface()); }
private static void BindAzureBlobServices(IKernel kernel) { // Bind to the Images blob container for DogController kernel.Bind<IBlobRepository>().To<K9BlobRepository>() .WhenInjectedInto<DogController>() .WithConstructorArgument("connectionString", ConfigurationManager.AppSettings["StorageAccountConnectionString"]) .WithConstructorArgument("imageContainer", ConfigurationManager.AppSettings["ImageBlobContainerName"]); // Bind to the Medical Records blob container for MedicalRecordsController kernel.Bind<IBlobRepository>().To<K9BlobRepository>() .WhenInjectedInto<MedicalRecordsController>() .WithConstructorArgument("connectionString", ConfigurationManager.AppSettings["StorageAccountConnectionString"]) .WithConstructorArgument("imageContainer", ConfigurationManager.AppSettings["MedicalRecordBlobContainerName"]); // Bind to the Notes blob container for MedicalRecordsController kernel.Bind<IBlobRepository>().To<K9BlobRepository>() .WhenInjectedInto<NotesController>() .WithConstructorArgument("connectionString", ConfigurationManager.AppSettings["StorageAccountConnectionString"]) .WithConstructorArgument("imageContainer", ConfigurationManager.AppSettings["NotesBlobContainerName"]); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IUnitOfWork>().To<DatabaseContext>(); kernel.Bind<ITrackRepository>().To<TrackRepository>().InRequestScope(); kernel.Bind<IAlbumRepository>().To<AlbumRepository>().InRequestScope(); //kernel.Bind<IFilmRepository>().To<FilmRepository>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<RestContext>().ToSelf().InRequestScope(); kernel.Bind<IRecipeRepository>().To<RecipeRepository>().InRequestScope(); kernel.Bind<ILanguageProvider>().To<LanguageProvider>().InRequestScope(); kernel.Bind<IRestaurantRepository>().To<RestaurantRepository>().InRequestScope(); }
public void Register(IKernel kernel) { kernel.Bind<ISessionAdapter>() .To<SessionAdapter>() .InRequestScope() .WithConstructorArgument( "session", ninjectContext => new HttpSessionStateWrapper(HttpContext.Current.Session) ); kernel.Bind<IMapPathAdapter>() .To<MapPathAdapter>() .InRequestScope() .WithConstructorArgument( "utility", ninjectContext => HttpContext.Current.Server ); kernel.Bind<IFileSaverAdapter>() .To<FileSaverAdapter>() .InRequestScope(); kernel.Bind<IDirectoryAdapter>() .To<DirectoryAdapter>() .InRequestScope(); kernel.Bind<IGuidAdapter>() .To<GuidAdapter>() .InRequestScope(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IMessageService>().To<MessageService>(); kernel.Bind<ICacheService>().To<CacheService>().InSingletonScope(); }
private void AddBindings(IKernel container) { container.Bind<IRssSourcesProvider>().To<RssSourcesProvider>().InSingletonScope(); container.Bind<INewsProvider>().To<NewsProvider>().InSingletonScope(); container.Bind<IContentStorage>().To<MemoryContentStorage>().InSingletonScope(); container.Bind<IParserProvider>().To<ParserProvider>().InSingletonScope(); }
/// <summary> /// Register all the binding. /// </summary> /// <param name="kernel"></param> private static void RegisterBindings(IKernel kernel) { kernel.Bind<RepositoryFactories>().To<RepositoryFactories>().InSingletonScope(); kernel.Bind<IClock>().To<Clock>().InSingletonScope(); kernel.Bind<IRepositoryProvider>().To<RepositoryProvider>(); kernel.Bind<IOfficeUow>().To<OfficeUow>().InRequestScope(); kernel.Bind<ISalesUow>().To<SalesUow>().InRequestScope(); kernel.Bind<ApplicationUserManager>().ToMethod(c => HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>()); kernel.Bind<ApplicationSignInManager>().ToMethod(c => HttpContext.Current.GetOwinContext().Get<ApplicationSignInManager>()); //kernel.Bind<IGeneticLineService>().To<GeneticLineService>().InRequestScope(); //kernel.Bind<IStandardService>().To<StandardService>().InRequestScope(); //kernel.Bind<IStandardGeneticLineService>().To<StandardGeneticLineService>().InRequestScope(); kernel.Bind(x => x.FromAssemblyContaining<Avicola.Sales.Services.ServiceBase>() .SelectAllClasses() .BindAllInterfaces() .Configure(c => c.InRequestScope())); kernel.Bind(x => x.FromAssemblyContaining<Avicola.Office.Services.ServiceBase>() .SelectAllClasses() .BindAllInterfaces() .Configure(c => c.InRequestScope())); //kernel.Bind<ICurrentUser>().To<CurrentUser>().InRequestScope(); kernel.Bind<IIdentity>().ToMethod(c => HttpContext.Current.User.Identity); }
/// <summary> /// An internal method called by the Protoinject module system. /// Use kernel.Load<ProtogameScriptIoCModule> to load this module. /// </summary> public void Load(IKernel kernel) { kernel.Bind<IAssetLoader>().To<LogicControlScriptAssetLoader>(); kernel.Bind<IAssetSaver>().To<LogicControlScriptAssetSaver>(); kernel.Bind<ILoadStrategy>().To<RawLogicControlScriptLoadStrategy>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { var config = MembershipRebootConfig.Create(); kernel.Bind<MembershipRebootConfiguration>().ToConstant(config); kernel.Bind<IUserAccountRepository>().To<CustomRepository>().InRequestScope(); kernel.Bind<AuthenticationService>().To<SamAuthenticationService>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<ICourseService>().To<CourseService>(); kernel.Bind<ICourseRepository>().To<CourseRepository>(); kernel.Bind<ICourseOfferingRepository>().To<CourseOfferingRepository>(); kernel.Bind<IStudentRepository>().To<StudentRepository>(); }
public static void RegisterServices(IKernel kernel) { kernel.Bind<IKanbanBoardRepository>().To<KanbanBoardRepository>(); kernel.Bind<IKanbanBoardReadService>().To<KanbanBoardReadService>(); kernel.Bind<IAuthenticationService>().To<KanbanAuthenticationService>(); kernel.Bind<IKanbanBoardCommandService>().To<KanbanBoardCommandService>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<LessonProjectDbDataContext>().ToMethod(c => new LessonProjectDbDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)); kernel.Bind<IRepository>().To<SqlRepository>().InRequestScope(); kernel.Bind<IMapper>().To<CommonMapper>().InSingletonScope(); kernel.Bind<IAuthentication>().To<CustomAuthentication>().InRequestScope(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IStartkickerDbContext>().To<StartkickerDbContext>().InRequestScope(); kernel.Bind(typeof(IRepository<>)).To(typeof(EfGenericRepository<>)); kernel.Bind<IPublisher>().To<PubNubNotifier>().InSingletonScope(); kernel.Bind(b => b.From("Startkicker.Services.Data").SelectAllClasses().BindDefaultInterface()); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IAutoContextFactory>() .To<AutoContextFactory>() .InSingletonScope() .OnActivation(x => x.AddAssemblyContaining<Post>().AddAssemblyContaining<HomeController>().AddEntitiesBasedOn<Entity>()); kernel.Bind<DbContext>() .ToMethod(x => kernel.Get<IAutoContextFactory>().Context()).InRequestScope() .WithConstructorArgument("connectionString", x => WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); kernel.Bind( x => x.FromAssemblyContaining<PostController>() .SelectAllClasses() .InheritedFrom<Profile>() .BindBase() .Configure(c => c.InSingletonScope())); kernel.Bind<Highlighter>().ToSelf().InSingletonScope(); Mapper.Initialize(x => { var profiles = typeof (PostController).Assembly.GetTypes() .Where(t => typeof (Profile).IsAssignableFrom(t)) .Union(typeof (Post).Assembly.GetTypes().Where(c => typeof (Profile).IsAssignableFrom(c))); foreach (var profile in profiles) x.AddProfile(kernel.GetService(profile) as Profile); x.ConstructServicesUsing(type => kernel.Get(type)); }); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IMenuParser>().To<ChudoPechkaHtmlParser>(); kernel.Bind<IMenuParser>().To<ChudoPechkaWordParser>(); kernel.Bind<IMenuParser>().To<McDonaldsParser>(); kernel.Bind<IPaymentRepository>().To<PaymentRepository>(); }
private void RegisterMappings(IKernel kernel) { // TODO: Make interface for the ApplicationDbContext! kernel.Bind<DbContext>().To<ApplicationDbContext>(); kernel.Bind<IBattleshipsData>().To<BattleshipsData>(); kernel.Bind<IUserIdProvider>().To<AspNetUserIdProvider>(); }
private static void RegisterServices(IKernel kernel) { kernel.Bind<IUserResposity>().To<UserResposity>(); kernel.Bind<INewsResposity>().To<NewsResposity>(); kernel.Bind<IDepartmentResposity>().To<DepartmentResposity>(); kernel.Bind<ICategoryResposity>().To<CategoryResposity>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { //// kernel.Bind<IArtistSystemData>().To<ArtistSystemData>(); kernel.Bind(b => b.From("ArtistSystem.Data").SelectAllClasses().BindDefaultInterfaces()); kernel.Bind<DbContext>().To<ArtistSystemContext>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<HttpClient>().ToMethod(ctx => ApiClient.GetClient()).InSingletonScope(); kernel.Bind<IFormsAuthentication>().To<AspNetFormsAuthentication>(); kernel.Bind<IBaseContext>().To<BaseContext>().InRequestScope(); kernel.Bind<IMapper>().To<AutoMapperService>().InSingletonScope(); }
private static void SetupKuduServices(IKernel kernel) { string root = HttpRuntime.AppDomainAppPath; string serviceSitePath = ConfigurationManager.AppSettings["serviceSitePath"]; string sitesPath = ConfigurationManager.AppSettings["sitesPath"]; string sitesBaseUrl = ConfigurationManager.AppSettings["urlBaseValue"]; string serviceSitesBaseUrl = ConfigurationManager.AppSettings["serviceUrlBaseValue"]; serviceSitePath = Path.Combine(root, serviceSitePath); sitesPath = Path.Combine(root, sitesPath); var pathResolver = new DefaultPathResolver(serviceSitePath, sitesPath); var settingsResolver = new DefaultSettingsResolver(sitesBaseUrl, serviceSitesBaseUrl); kernel.Bind<IPathResolver>().ToConstant(pathResolver); kernel.Bind<ISettingsResolver>().ToConstant(settingsResolver); kernel.Bind<ISiteManager>().To<SiteManager>().InSingletonScope(); kernel.Bind<KuduEnvironment>().ToMethod(_ => new KuduEnvironment { RunningAgainstLocalKuduService = true, IsAdmin = IdentityHelper.IsAnAdministrator(), ServiceSitePath = pathResolver.ServiceSitePath, SitesPath = pathResolver.SitesPath }); // TODO: Integrate with membership system kernel.Bind<ICredentialProvider>().ToConstant(new BasicAuthCredentialProvider("admin", "kudu")); kernel.Bind<IApplicationService>().To<ApplicationService>().InRequestScope(); kernel.Bind<ISettingsService>().To<SettingsService>(); // Sql CE setup Directory.CreateDirectory(Path.Combine(root, "App_Data")); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { //IProductRepository kernel.Bind<ICategoryRepository>().To<CategoryDataMapper>().InSingletonScope(); kernel.Bind<IProductRepository>().To<ProductDataMapper>().InSingletonScope(); kernel.Bind<IPictureRepository>().To<PictureDataMapper>().InSingletonScope(); }
public void Register(IKernel kernel) { kernel.Bind<IFileSystemService> ().To<FileSystemService> ().InSingletonScope (); kernel.Bind<ILocalizer> ().To<Localizer> ().InSingletonScope (); kernel.Bind<ISQLitePlatform> ().To<SQLitePlatformIOS> ().InSingletonScope (); kernel.Bind<IPlatformException> ().To<PlatformException> ().InSingletonScope (); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<IUserRepository>().To<UserManagerWrapper>(); kernel.Bind<IGroupRepository>().To<RoleManagerWrapper>(); kernel.Bind<IGigRepository>().To<EFGigRepository>(); kernel.Bind<IMemberRepository>().To<EFMemberRepository>(); }
public static void RegisterServices(IKernel kernel) { kernel.Bind<IFileParser>().To<XlsParser>(); kernel.Bind<IDataParser>().To<DataParser>(); kernel.Bind<IDashboardService>().To<DashboardService>(); kernel.Bind<IUnitOfWorkFactory>().To<UnitOfWorkFactory>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IBlogRepository>().ToConstant(new Initialize()); }
public override void Load() { IKernel kernel = this.Kernel; kernel?.Bind <ISerial>().To <Serial>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IForecastDAL>().To <ForecastDAL>().WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["National-parkDB"].ConnectionString); kernel.Bind <IParkDAL>().To <ParkDAL>().WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["National-parkDB"].ConnectionString); kernel.Bind <ISurveyDAL>().To <SurveyDAL>().WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["National-parkDB"].ConnectionString); }
private void AddBindings() { kernel.Bind <IActivityTypeRepository>().To <ActivityTypeRepository>(); kernel.Bind <IOrganizationRepository>().To <OrganizationRepository>(); kernel.Bind(typeof(IRepository <>)).To(typeof(Repository <>)); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IImageRepository>().To <ImageRepository>(); kernel.Bind <ILampRepository>().To <LampRepository>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <ICountingKsRepository>().To <CountingKsRepository>(); kernel.Bind <CountingKsContext>().To <CountingKsContext>(); kernel.Bind <ICountingKsIdentityService>().To <CountingKsIdentityService>(); }
protected override void Configure() { _kernel = new StandardKernel(new BaseModules(), new ArtemisModules(), new ManagerModules()); _kernel.Bind <IWindowManager>().To <WindowManager>().InSingletonScope(); _kernel.Bind <IEventAggregator>().To <EventAggregator>().InSingletonScope(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IDbContext>().To <MyDbContext>().InRequestScope(); kernel.Bind <IUnitOfWork>().To <UnitOfWork <MyDbContext> >().InRequestScope(); kernel.Bind <IBeerDataObjectBussinessManger>().To <BeerDataObjectBussinessManger <BeerDataObjectRepository> >(); }
private void AddBindings() { kernel.Bind <IImageRepository>().To <EFImageRepository>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> public static void RegisterServices(IKernel kernel) { kernel.Bind <IDependency>().To <Dependency>(); }
public void MyTestInitialize() { Kernel = new StandardKernel(new PluginModule <TestPlugin>()); Kernel.Bind <IPluginSource>().To <PluginsTestSource>(); }
private void AddBindings() { kernel.Bind <IEnrolleeRepository>().To <EFEnrolleeRepository>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IUserSession>().To <UserSession>(); kernel.Bind <IHttpClientRepo>().To <HttpClientRepo>(); }
private void AddBindings() { kernel.Bind <IProductRepository>().To <EFProductRepository>(); }
private static void RegisterServices(IKernel kernel) { var serverConfiguration = new ServerConfiguration(); // Make sure %HOME% is correctly set EnsureHomeEnvironmentVariable(); EnsureSiteBitnessEnvironmentVariable(); IEnvironment environment = GetEnvironment(); EnsureDotNetCoreEnvironmentVariable(environment); // Add various folders that never change to the process path. All child processes will inherit PrependFoldersToPath(environment); // Per request environment kernel.Bind <IEnvironment>().ToMethod(context => GetEnvironment(context.Kernel.Get <IDeploymentSettingsManager>())) .InRequestScope(); // General kernel.Bind <IServerConfiguration>().ToConstant(serverConfiguration); kernel.Bind <IBuildPropertyProvider>().ToConstant(new BuildPropertyProvider()); System.Func <ITracer> createTracerThunk = () => GetTracer(environment, kernel); System.Func <ILogger> createLoggerThunk = () => GetLogger(environment, kernel); // First try to use the current request profiler if any, otherwise create a new one var traceFactory = new TracerFactory(() => TraceServices.CurrentRequestTracer ?? createTracerThunk()); kernel.Bind <ITracer>().ToMethod(context => TraceServices.CurrentRequestTracer ?? NullTracer.Instance); kernel.Bind <ITraceFactory>().ToConstant(traceFactory); TraceServices.SetTraceFactory(createTracerThunk, createLoggerThunk); // Setup the deployment lock string lockPath = Path.Combine(environment.SiteRootPath, Constants.LockPath); string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile); string statusLockPath = Path.Combine(lockPath, Constants.StatusLockFile); string sshKeyLockPath = Path.Combine(lockPath, Constants.SSHKeyLockFile); string hooksLockPath = Path.Combine(lockPath, Constants.HooksLockFile); _deploymentLock = new DeploymentLockFile(deploymentLockPath, kernel.Get <ITraceFactory>()); _deploymentLock.InitializeAsyncLocks(); var statusLock = new LockFile(statusLockPath, kernel.Get <ITraceFactory>()); var sshKeyLock = new LockFile(sshKeyLockPath, kernel.Get <ITraceFactory>()); var hooksLock = new LockFile(hooksLockPath, kernel.Get <ITraceFactory>()); kernel.Bind <IOperationLock>().ToConstant(sshKeyLock).WhenInjectedInto <SSHKeyController>(); kernel.Bind <IOperationLock>().ToConstant(statusLock).WhenInjectedInto <DeploymentStatusManager>(); kernel.Bind <IOperationLock>().ToConstant(hooksLock).WhenInjectedInto <WebHooksManager>(); kernel.Bind <IOperationLock>().ToConstant(_deploymentLock); var shutdownDetector = new ShutdownDetector(); shutdownDetector.Initialize(); IDeploymentSettingsManager noContextDeploymentsSettingsManager = new DeploymentSettingsManager(new XmlSettings.Settings(GetSettingsPath(environment))); TraceServices.TraceLevel = noContextDeploymentsSettingsManager.GetTraceLevel(); var noContextTraceFactory = new TracerFactory(() => GetTracerWithoutContext(environment, noContextDeploymentsSettingsManager)); kernel.Bind <IAnalytics>().ToMethod(context => new Analytics(context.Kernel.Get <IDeploymentSettingsManager>(), context.Kernel.Get <IServerConfiguration>(), noContextTraceFactory)); // Trace unhandled (crash) exceptions. AppDomain.CurrentDomain.UnhandledException += (sender, args) => { var ex = args.ExceptionObject as Exception; if (ex != null) { kernel.Get <IAnalytics>().UnexpectedException(ex); } }; // Trace shutdown event // Cannot use shutdownDetector.Token.Register because of race condition // with NinjectServices.Stop via WebActivator.ApplicationShutdownMethodAttribute Shutdown += () => TraceShutdown(environment, noContextDeploymentsSettingsManager); // LogStream service // The hooks and log stream start endpoint are low traffic end-points. Re-using it to avoid creating another lock var logStreamManagerLock = hooksLock; kernel.Bind <LogStreamManager>().ToMethod(context => new LogStreamManager(Path.Combine(environment.RootPath, Constants.LogFilesPath), context.Kernel.Get <IEnvironment>(), context.Kernel.Get <IDeploymentSettingsManager>(), context.Kernel.Get <ITracer>(), shutdownDetector, logStreamManagerLock)); kernel.Bind <InfoRefsController>().ToMethod(context => new InfoRefsController(t => context.Kernel.Get(t))) .InRequestScope(); kernel.Bind <CustomGitRepositoryHandler>().ToMethod(context => new CustomGitRepositoryHandler(t => context.Kernel.Get(t))) .InRequestScope(); // Deployment Service kernel.Bind <ISettings>().ToMethod(context => new XmlSettings.Settings(GetSettingsPath(environment))) .InRequestScope(); kernel.Bind <IDeploymentSettingsManager>().To <DeploymentSettingsManager>() .InRequestScope(); kernel.Bind <IDeploymentStatusManager>().To <DeploymentStatusManager>() .InRequestScope(); kernel.Bind <ISiteBuilderFactory>().To <SiteBuilderFactory>() .InRequestScope(); kernel.Bind <IWebHooksManager>().To <WebHooksManager>() .InRequestScope(); ITriggeredJobsManager triggeredJobsManager = new TriggeredJobsManager( noContextTraceFactory, kernel.Get <IEnvironment>(), kernel.Get <IDeploymentSettingsManager>(), kernel.Get <IAnalytics>(), kernel.Get <IWebHooksManager>()); kernel.Bind <ITriggeredJobsManager>().ToConstant(triggeredJobsManager) .InTransientScope(); TriggeredJobsScheduler triggeredJobsScheduler = new TriggeredJobsScheduler( triggeredJobsManager, noContextTraceFactory, environment, kernel.Get <IAnalytics>()); kernel.Bind <TriggeredJobsScheduler>().ToConstant(triggeredJobsScheduler) .InTransientScope(); IContinuousJobsManager continuousJobManager = new ContinuousJobsManager( noContextTraceFactory, kernel.Get <IEnvironment>(), kernel.Get <IDeploymentSettingsManager>(), kernel.Get <IAnalytics>()); OperationManager.SafeExecute(triggeredJobsManager.CleanupDeletedJobs); OperationManager.SafeExecute(continuousJobManager.CleanupDeletedJobs); kernel.Bind <IContinuousJobsManager>().ToConstant(continuousJobManager) .InTransientScope(); kernel.Bind <ILogger>().ToMethod(context => GetLogger(environment, context.Kernel)) .InRequestScope(); kernel.Bind <IDeploymentManager>().To <DeploymentManager>() .InRequestScope(); kernel.Bind <IAutoSwapHandler>().To <AutoSwapHandler>() .InRequestScope(); kernel.Bind <ISSHKeyManager>().To <SSHKeyManager>() .InRequestScope(); kernel.Bind <IRepositoryFactory>().ToMethod(context => _deploymentLock.RepositoryFactory = new RepositoryFactory(context.Kernel.Get <IEnvironment>(), context.Kernel.Get <IDeploymentSettingsManager>(), context.Kernel.Get <ITraceFactory>())) .InRequestScope(); kernel.Bind <IApplicationLogsReader>().To <ApplicationLogsReader>() .InSingletonScope(); // Git server kernel.Bind <IDeploymentEnvironment>().To <DeploymentEnvrionment>(); kernel.Bind <IGitServer>().ToMethod(context => new GitExeServer(context.Kernel.Get <IEnvironment>(), _deploymentLock, GetRequestTraceFile(context.Kernel), context.Kernel.Get <IRepositoryFactory>(), context.Kernel.Get <IDeploymentEnvironment>(), context.Kernel.Get <IDeploymentSettingsManager>(), context.Kernel.Get <ITraceFactory>())) .InRequestScope(); // Git Servicehook parsers kernel.Bind <IServiceHookHandler>().To <GenericHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <GitHubHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <BitbucketHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <BitbucketHandlerV2>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <DropboxHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <CodePlexHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <CodebaseHqHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <GitlabHqHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <GitHubCompatHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <KilnHgHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <VSOHandler>().InRequestScope(); kernel.Bind <IServiceHookHandler>().To <OneDriveHandler>().InRequestScope(); // SiteExtensions kernel.Bind <ISiteExtensionManager>().To <SiteExtensionManager>().InRequestScope(); // Functions kernel.Bind <IFunctionManager>().To <FunctionManager>().InRequestScope(); // Command executor kernel.Bind <ICommandExecutor>().To <CommandExecutor>().InRequestScope(); MigrateSite(environment, noContextDeploymentsSettingsManager); RemoveOldTracePath(environment); RemoveTempFileFromUserDrive(environment); // Temporary fix for https://github.com/npm/npm/issues/5905 EnsureNpmGlobalDirectory(); EnsureUserProfileDirectory(); // Skip SSL Certificate Validate OperationClient.SkipSslValidationIfNeeded(); // Make sure webpages:Enabled is true. Even though we set it in web.config, it could be overwritten by // an Azure AppSetting that's supposed to be for the site only but incidently affects Kudu as well. ConfigurationManager.AppSettings["webpages:Enabled"] = "true"; // Kudu does not rely owin:appStartup. This is to avoid Azure AppSetting if set. if (ConfigurationManager.AppSettings["owin:appStartup"] != null) { // Set the appSetting to null since we cannot use AppSettings.Remove(key) (ReadOnly exception!) ConfigurationManager.AppSettings["owin:appStartup"] = null; } RegisterRoutes(kernel, RouteTable.Routes); // Register the default hubs route: ~/signalr GlobalHost.DependencyResolver = new SignalRNinjectDependencyResolver(kernel); GlobalConfiguration.Configuration.Filters.Add( new TraceDeprecatedActionAttribute( kernel.Get <IAnalytics>(), kernel.Get <ITraceFactory>())); GlobalConfiguration.Configuration.Filters.Add(new EnsureRequestIdHandlerAttribute()); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IProductMasterDataService>().To <ProductMasterDataService>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IEmployee>().To <EmployeeRepository>(); kernel.Bind <IGender>().To <GenderRepository>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind(typeof(DbContext)).To(typeof(MainContext)).InRequestScope(); kernel.Bind(typeof(IRepository <>)).To(typeof(Repository <>)).InRequestScope(); kernel.Bind(typeof(IReadOnlyRepository <>)).To(typeof(ReadOnlyRepository <>)).InRequestScope(); kernel.Bind(typeof(IDocumentRepository <>)).To(typeof(DocumentRepository <>)).InRequestScope(); kernel.Bind <LoggedUser>().ToMethod(ctx => { return(new LoggedUser((ClaimsIdentity)HttpContext.Current.User?.Identity)); }).InRequestScope(); kernel.Bind(typeof(ReadOnlyLogic <>)).ToSelf().InRequestScope(); kernel.Bind(typeof(Logic <>)).ToSelf().InRequestScope(); kernel.Bind(typeof(DocumentLogic <>)).ToSelf().InRequestScope(); #region Specific App Bindings ///Start:Generated:DI<<< kernel.Bind <IShiftLogic>().To <ShiftLogic>(); kernel.Bind <ICertificationLogic>().To <CertificationLogic>(); kernel.Bind <IJobPositionLogic>().To <JobPositionLogic>(); kernel.Bind <ILevel1Logic>().To <Level1Logic>(); kernel.Bind <ILevel2Logic>().To <Level2Logic>(); kernel.Bind <ILevel3Logic>().To <Level3Logic>(); kernel.Bind <ILevel4Logic>().To <Level4Logic>(); kernel.Bind <ILevel5Logic>().To <Level5Logic>(); kernel.Bind <IEmployeeLogic>().To <EmployeeLogic>(); kernel.Bind <ITrainingLogic>().To <TrainingLogic>(); kernel.Bind <ITrainingScoreLogic>().To <TrainingScoreLogic>(); kernel.Bind <IFormatoDC3Logic>().To <FormatoDC3Logic>(); kernel.Bind <ISkillLogic>().To <SkillLogic>(); ///End:Generated:DI<<< #endregion kernel.Bind <IRoleLogic>().To <RoleLogic>(); kernel.Bind <IApplicationLogic>().To <ApplicationLogic>(); kernel.Bind <IUserLogic>().To <UserLogic>(); kernel.Bind <IWorkflowLogic>().To <WorkflowLogic>(); kernel.Bind <IStepLogic>().To <StepLogic>(); kernel.Bind <IStepOperationLogic>().To <StepOperationLogic>(); kernel.Bind <ITrackLogic>().To <TrackLogic>(); kernel.Bind <ITokenLogic>().To <TokenLogic>(); kernel.Bind(typeof(BaseController <>)).ToSelf().InRequestScope(); kernel.Bind(typeof(ReadOnlyBaseController <>)).ToSelf().InRequestScope(); kernel.Bind(typeof(DocumentController <>)).ToSelf().InRequestScope(); }
public static void Configure(IKernel kernel) { kernel.Bind <HttpSessionState>().ToProvider <HttpSessionStateProvider>(); kernel.Bind <ICryptography>().To <CryptoUtils>(); kernel.Bind <IAuthenticationService>().To <FormsAuthenticationService>(); kernel.Bind <IWebDavManager>().To <WebDavManager>(); kernel.Bind <IAccessTokenManager>().To <AccessTokenManager>(); kernel.Bind <IWopiServer>().To <WopiServer>(); kernel.Bind <IWopiFileManager>().To <CobaltSessionManager>(); kernel.Bind <IWebDavAuthorizationService>().To <WebDavAuthorizationService>(); kernel.Bind <ICobaltManager>().To <CobaltManager>(); kernel.Bind <ITtlStorage>().To <CacheTtlStorage>(); kernel.Bind <IUserSettingsManager>().To <UserSettingsManager>(); kernel.Bind <ISmsDistributionService>().To <TwillioSmsDistributionService>(); kernel.Bind <ISmsAuthenticationService>().To <SmsAuthenticationService>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <DbContext>().To <ApplicationDbContext>(); }
private void AddBindings() { kernel.Bind <IVisitorRepository>().To <VisitorRepository>(); }
protected override void Configure(IKernel kernel, BaseCommonConfig commonConfig) { kernel.Bind <IGpuService>().To <GpuService>(); kernel.Get <ILog>().Error("tresint 123"); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IProductRepository>().To <ProductRepository>(); kernel.Bind <IHttpControllerSelector>().ToConstant(new RouteVersionedControllerSelector(GlobalConfiguration.Configuration)).InSingletonScope(); kernel.Bind <IApiExplorer>().ToConstant(new VersionedApiExplorer(GlobalConfiguration.Configuration)).InSingletonScope(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IParkWeatherDal>().To <ParkWeatherSqlDal>().WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["ParkWeatherDb"].ConnectionString); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IAnalistaRepository>().To <AnalistaRepository>(); kernel.Bind <IBinanceStatusRepository>().To <BinanceStatusRepository>(); kernel.Bind <ICancelamentoChamadaRepository>().To <CancelamentoChamadasRepository>(); kernel.Bind <ICancelamentoRecusadoRepository>().To <CancelamentoRecusadoRepository>(); kernel.Bind <IChamadasRepository>().To <ChamadasRepository>(); kernel.Bind <IChamadaEditadaRepository>().To <ChamadaEditadaRepository>(); kernel.Bind <IChamadaStatusRepository>().To <ChamadasStatusRepository>(); kernel.Bind <IConfirmEmailRepository>().To <ConfirmEmailRepository>(); kernel.Bind <IEdicaoAceitaRepository>().To <EdicaoAceitaRepository>(); kernel.Bind <IFiltersRepository>().To <FiltersRepository>(); kernel.Bind <IOrdemRepository>().To <OrdemRepository>(); kernel.Bind <IOrdemComissionRepository>().To <OrdemComissionRepository>(); kernel.Bind <IOrdemStatusRepository>().To <OrdemStatusRepository>(); kernel.Bind <IPagamentoLicencaRepository>().To <PagamentoLicencaRepository>(); kernel.Bind <IRecuperarSenha>().To <RecuperarSenhaRepository>(); kernel.Bind <IServerConfigRepository>().To <ServerConfigRepository>(); kernel.Bind <ISymbolRepository>().To <SymbolRepository>(); kernel.Bind <ITipoEdicaoAceitaRepository>().To <TipoEdicaoAceitaRepository>(); kernel.Bind <ITipoOrdemRepository>().To <TipoOrdemRepository>(); kernel.Bind <IUsuarioRepository>().To <UsuarioRepository>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <ICalculator>().To <Calculator>(); kernel.Bind <Calculator>().To <Calculator>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <ILogger>().To <Logger>(); }
private void AddBindings(IKernel container) { ConfigureLog4net(container); ConfigureUserSession(container); ConfigureNHibernate(container); ConfigureAutoMapper(container); container.Bind <IDateTime>().To <DateTimeAdapter>().InSingletonScope(); container.Bind <IAddTaskQueryProcessor>().To <AddTaskQueryProcessor>().InRequestScope(); container.Bind <IAddTaskMaintenanceProcessor>().To <AddTaskMaintenanceProcessor>().InRequestScope(); container.Bind <IBasicSecurityService>().To <BasicSecurityService>().InSingletonScope(); container.Bind <ITaskByIdQueryProcessor>().To <TaskByIdQueryProcessor>().InRequestScope(); container.Bind <IUpdateTaskStatusQueryProcessor>().To <UpdateTaskStatusQueryProcessor>().InRequestScope(); container.Bind <IStartTaskWorkflowProcessor>().To <StartTaskWorkflowProcessor>().InRequestScope(); container.Bind <ICompleteTaskWorkflowProcessor>().To <CompleteTaskWorkflowProcessor>().InRequestScope(); container.Bind <IReactivateTaskWorkflowProcessor>().To <ReactivateTaskWorkflowProcessor>().InRequestScope(); container.Bind <ITaskByIdInquiryProcessor>().To <TaskByIdInquiryProcessor>().InRequestScope(); container.Bind <IUpdateTaskQueryProcessor>().To <UpdateTaskQueryProcessor>().InRequestScope(); container.Bind <ITaskUsersMaintenanceProcessor>().To <TaskUsersMaintenanceProcessor>().InRequestScope(); container.Bind <IUpdateablePropertyDetector>().To <JObjectUpdateablePropertyDetector>().InSingletonScope(); container.Bind <IUpdateTaskMaintenanceProcessor>().To <UpdateTaskMaintenanceProcessor>().InRequestScope(); container.Bind <IPagedDataRequestFactory>().To <PagedDataRequestFactory>().InSingletonScope(); container.Bind <IAllTasksQueryProcessor>().To <AllTasksQueryProcessor>().InRequestScope(); container.Bind <IAllTasksInquiryProcessor>().To <AllTasksInquiryProcessor>().InRequestScope(); container.Bind <ICommonLinkService>().To <CommonLinkService>().InRequestScope(); container.Bind <IUserLinkService>().To <UserLinkService>().InRequestScope(); container.Bind <ITaskLinkService>().To <TaskLinkService>().InRequestScope(); container.Bind <ITasksControllerDependencyBlock>().To <TasksControllerDependencyBlock>().InRequestScope(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IUserRepository>().To <FakeUserRepository>(); }
public IBindingToSyntax <T> Bind <T>() { return(kernel.Bind <T>()); }