当前位置: 首页>>代码示例>>C#>>正文


C# IKernel.Bind方法代码示例

本文整理汇总了C#中IKernel.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# IKernel.Bind方法的具体用法?C# IKernel.Bind怎么用?C# IKernel.Bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IKernel的用法示例。


在下文中一共展示了IKernel.Bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterServices

 /// <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>();
 }
开发者ID:datachomp,项目名称:StackOverFaux,代码行数:11,代码来源:NinjectMVC3.cs

示例2: BindAzureBlobServices

        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"]);
        }
开发者ID:paulirwin,项目名称:k94warriors,代码行数:26,代码来源:NinjectWebCommon.cs

示例3: RegisterServices

 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);
 }
开发者ID:Adamsons,项目名称:Weather,代码行数:7,代码来源:NinjectWebCommon.cs

示例4: RegisterServices

        /// <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();

        }        
开发者ID:alkukampela,项目名称:killer_appi,代码行数:11,代码来源:NinjectWebCommon.cs

示例5: RegisterServices

 /// <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();
 }
开发者ID:Buccaneer,项目名称:3d-mobi-05-eva-rest-back-end,代码行数:11,代码来源:NinjectWebCommon.cs

示例6: RegisterServices

 /// <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>();
 }
开发者ID:nmsampaio,项目名称:BrockAllen.MembershipReboot,代码行数:11,代码来源:NinjectWebCommon.cs

示例7: RegisterBindings

        /// <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);
        }
开发者ID:pragmasolutions,项目名称:avicola,代码行数:32,代码来源:IocConfig.cs

示例8: RegisterServices

 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>();
 }
开发者ID:CaoShoTing,项目名称:NSMS,代码行数:7,代码来源:NinjectWebCommon.cs

示例9: Register

		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 ();
		}
开发者ID:dtimyr,项目名称:xamarin,代码行数:7,代码来源:iOSRegistry.cs

示例10: RegisterServices

        /// <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>();
        }
开发者ID:viktorD1m1trov,项目名称:T-Academy,代码行数:11,代码来源:NinjectConfig.cs

示例11: RegisterServices

 /// <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();
 }        
开发者ID:haiconmot,项目名称:SmsQuiz,代码行数:11,代码来源:NinjectWebCommon.cs

示例12: RegisterServices

 /// <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();
 }
开发者ID:jarheghan,项目名称:PlumberingStore,代码行数:11,代码来源:NinjectWebCommon.cs

示例13: SetupKuduServices

        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"));
        }
开发者ID:remcoros,项目名称:kudu,代码行数:33,代码来源:Startup.cs

示例14: RegisterServices

 /// <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>();
 }        
开发者ID:philpursglove,项目名称:SCB.old,代码行数:11,代码来源:NinjectWebCommon.cs

示例15: RegisterServices

 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>();
 }
开发者ID:marcusoftnet,项目名称:KanbanBoards,代码行数:7,代码来源:AppStart_NinjectMVC3.cs


注:本文中的IKernel.Bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。