本文整理汇总了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>();
}
示例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"]);
}
示例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);
}
示例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();
}
示例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();
}
示例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>();
}
示例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);
}
示例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>();
}
示例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 ();
}
示例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>();
}
示例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();
}
示例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();
}
示例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"));
}
示例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>();
}
示例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>();
}