private static void CheckKernel() { if (Kernel != null) return; Kernel = ServiceRegistry.Current as IKernel; Guard.NotNull(Kernel, "Kernal"); }
/// <inheritdoc/> public override void Init(NLite.Mini.Activation.IActivator activator, IKernel kernel, IComponentInfo info, Action<IComponentInfo, object> onDestroying, Action<IComponentContext> onFetch) { Guard.NotNull(activator, "activator"); Guard.NotNull(kernel, "kernel"); Guard.NotNull(info, "info"); Real.Init(new ProxyActivator(activator), kernel, info, onDestroying,OnFetch); }
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); }
private static IList<IContentProvider> GetContentProviders(IKernel kernel) { // Use MEF to locate the content providers in this assembly var compositionContainer = new CompositionContainer(new AssemblyCatalog(typeof(ResourceProcessor).Assembly)); compositionContainer.ComposeExportedValue(kernel); return compositionContainer.GetExportedValues<IContentProvider>().ToList(); }
/// <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>(); }
private void RegisterIConfigurationProviderAndIProfileExpression(IKernel kernel) { kernel.Register( Component.For<IConfigurationProvider, IProfileExpression>() .UsingFactoryMethod(k => new Configuration(MapperRegistry.AllMappers())) ); }
private void RegisterIMappingEngine(IKernel kernel) { kernel.Register( Component.For<IMappingEngine>() .UsingFactoryMethod(k => new MappingEngine(kernel.Resolve<IConfigurationProvider>())) ); }
/// <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()); }
public override void Register(IKernel kernel) { AddFacility<FactorySupportFacility>(kernel); RegisterIConfigurationProviderAndIProfileExpression(kernel); RegisterIMappingEngine(kernel); }
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"]); }
public void ProcessModel(IKernel kernel, ComponentModel model) { if (model.Configuration == null) { return; } var remoteserverAttValue = model.Configuration.Attributes["remoteserver"]; var remoteclientAttValue = model.Configuration.Attributes["remoteclient"]; var server = RemotingStrategy.None; var client = RemotingStrategy.None; if (remoteserverAttValue == null && remoteclientAttValue == null) { return; } if (remoteserverAttValue != null) { server = converter.PerformConversion<RemotingStrategy>(remoteserverAttValue); } if (remoteclientAttValue != null) { client = converter.PerformConversion<RemotingStrategy>(remoteclientAttValue); } DoSemanticCheck(server, model, client); ConfigureServerComponent(server, model.Implementation, model); ConfigureClientComponent(client, model.Services.Single(), model); }
/// <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<EntitiesContext>().InRequestScope(); kernel.Bind<IDepartmentService>().To<DepartmentService>().InRequestScope(); kernel.Bind<IGroupService>().To<GroupService>().InRequestScope(); #region category kernel.Bind<ICityCateService>().To<CityCateService>().InRequestScope(); kernel.Bind<IFileCateService>().To<FileCateService>().InRequestScope(); kernel.Bind<IRuleCateService>().To<RuleCateService>().InRequestScope(); kernel.Bind<IJobCateService>().To<JobCateService>().InRequestScope(); kernel.Bind<IContractCateService>().To<ContractCateService>().InRequestScope(); kernel.Bind<IJobTitleCateService>().To<JobTitleCateService>().InRequestScope(); kernel.Bind<IRelationCateService>().To<RelationCateService>().InRequestScope(); kernel.Bind<IIndustryCateService>().To<IndustryCateService>().InRequestScope(); kernel.Bind<ICustomerCateService>().To<CustomerCateService>().InRequestScope(); kernel.Bind<ICoopCateService>().To<CoopCateService>().InRequestScope(); kernel.Bind<ISourceCateService>().To<SourceCateService>().InRequestScope(); #endregion kernel.Bind<ICustomerCompanyService>().To<CustomerCompanyService>().InRequestScope(); kernel.Bind<ICustomerShareService>().To<CustomerShareService>().InRequestScope(); kernel.Bind<ICustomerService>().To<CustomerService>().InRequestScope(); kernel.Bind<IMemberService>().To<MemberService>().InRequestScope(); kernel.Bind<IMember_ActionService>().To<Member_ActionService>().InRequestScope(); kernel.Bind<IPlanLogService>().To<PlanLogService>().InRequestScope(); }
public void Init(IKernel kernel, Castle.Core.Configuration.IConfiguration facilityConfig) { Assert.IsNotNull(kernel); Assert.IsNotNull(facilityConfig); Initialized = true; }
/// <summary> /// Searches for the component activator in the configuration and, if unsuccessful /// look for the component activator attribute in the implementation type. /// </summary> /// <param name = "kernel">The kernel instance</param> /// <param name = "model">The model instance</param> public virtual void ProcessModel(IKernel kernel, ComponentModel model) { if (!ReadComponentActivatorFromConfiguration(model)) { ReadComponentActivatorFromType(model); } }
/// <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()); }
public TextTest(IKernel kernel, GraphicsDevice device, ContentManager content) : base("Text Test", kernel) { _kernel = kernel; _device = device; _content = content; }
/// <summary> /// Constructs an AbstractComponentActivator /// </summary> protected AbstractComponentActivator(ComponentModel model, IKernel kernel, ComponentInstanceDelegate onCreation, ComponentInstanceDelegate onDestruction) { this.model = model; this.kernel = kernel; this.onCreation = onCreation; this.onDestruction = onDestruction; }
/// <summary> /// Initializes a new instance of the <see cref="ControlComponentInspector"/> class. /// </summary> /// <param name="kernel">The kernel.</param> /// <param name="config">The config.</param> public ControlComponentInspector(IKernel kernel, IConfiguration config) { marshalingControl = new MarshalingControl(); controlProxyHook = ObtainProxyHook(kernel, config); RegisterWindowsFormsSynchronizationContext(kernel); }
public MessageHandler(IKernel kernel, ITransport transport, ISerializer serializer, TimeoutManager timeoutManager) { m_kernel = kernel; m_transport = transport; m_serializer = serializer; m_timeoutManager = timeoutManager; }
/// <summary> /// Constructor /// </summary> public RelativePathSubDependencyResolver(IKernel kernel) { m_converter = (IConversionManager)kernel.GetSubSystem(SubSystemConstants.ConversionManagerKey); SettingsSubSystem settingsSubSystem = kernel.GetSettingsSubSystem(); settingsSubSystem.ResolveRelativePaths = true; VALUES = new Dictionary<string, object>(); }
public static void MyClassInitialize(TestContext testContext) { kernel = new StandardKernel(new TestModule(), new DalIoc(), new BusinessIoc()); var auth = kernel.Get<IAuthenticationService>(); var uh = kernel.Get<IUtilisateurBusinessHelper<Utilisateur>>(); uh.DeleteAll().Wait(); uh.Create("999", "jcambert", "korben90", "Ambert", "Jean-Christophe", "*****@*****.**") .ContinueWith(x => { uh.AddRole(x.Result, "Administrateur"); }) .ContinueWith(x => { uh.Save(); }).ContinueWith(x => { var islogin = auth.Login("999", "jcambert", "korben90"); Assert.IsTrue(islogin.Result); }).Wait() ; ah = kernel.Get<ArticleBusinessHelper<Article>>(); ctx = kernel.Get<IDbContext>(); }
public ActiveFeatureFactory(IKernel kernel, IInstanceConfiguration instanceConfiguration, ILog log, ILoggingConfiguration loggingConfiguration) { _kernel = kernel; _instanceConfiguration = instanceConfiguration; _log = log; _loggingConfiguration = loggingConfiguration; }
public ProductVariantModelBinder(ISetVariantTypeProperties setVariantTypeProperties, ISetRestrictedShippingMethods setRestrictedShippingMethods, ISetETagService setETagService, IKernel kernel) : base(kernel) { _setVariantTypeProperties = setVariantTypeProperties; _setRestrictedShippingMethods = setRestrictedShippingMethods; _setETagService = setETagService; }
public static void Configure(IKernel kernel) { kernel.Load(new [] { new ConfigurationModule(), }); }
/// <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>(); }
public ParticlesTest(IKernel kernel, ContentManager content, GraphicsDevice device) : base("Particles", kernel) { _kernel = kernel; _content = content; _device = device; }
/// <summary> /// Queries the kernel's ConfigurationStore for a configuration /// associated with the component name. /// </summary> /// <param name="kernel"></param> /// <param name="model"></param> public virtual void ProcessModel(IKernel kernel, ComponentModel model) { IConfiguration config = kernel.ConfigurationStore.GetComponentConfiguration(model.Name) ?? kernel.ConfigurationStore.GetBootstrapComponentConfiguration(model.Name); model.Configuration = config; }
public void ProcessModel(IKernel kernel, ComponentModel model) { if (model.Configuration == null) { return; } var mixins = model.Configuration.Children["mixins"]; if (mixins == null) { return; } var mixinReferences = new List<ComponentReference<object>>(); foreach (var mixin in mixins.Children) { var value = mixin.Value; var mixinComponent = ReferenceExpressionUtil.ExtractComponentKey(value); if (mixinComponent == null) { throw new Exception( String.Format("The value for the mixin must be a reference to a component (Currently {0})", value)); } mixinReferences.Add(new ComponentReference<object>("mixin-" + mixinComponent, mixinComponent)); } if (mixinReferences.Count == 0) { return; } var options = ProxyUtil.ObtainProxyOptions(model, true); mixinReferences.ForEach(options.AddMixinReference); }
public object Create(IProxyFactoryExtension customFactory, IKernel kernel, ComponentModel model, CreationContext context, params object[] constructorArguments) { throw new NotImplementedException( "You must supply an implementation of IProxyFactory " + "to use interceptors on the Microkernel"); }
/// <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 FactoryActivator(ComponentModel model, IKernel kernel, ComponentInstanceDelegate onCreation, ComponentInstanceDelegate onDestruction) : base(model, kernel, onCreation, onDestruction) { }
public NinjectResolver(params INinjectModule[] modules) { kernel = new StandardKernel(modules); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { }
/// <summary> /// Entry method used by caller to configure the given /// container with all of this application's /// dependencies. /// </summary> public void Configure(IKernel container) { AddBindings(container); }
/// <summary> /// Initializes a new instance of the <see cref="ChildActivationCache"/> class. /// </summary> /// <param name="kernel">The kernel.</param> public ChildActivationCache(IKernel kernel) { this.parentCache = ((IChildKernel)kernel).ParentResolutionRoot.Get <IKernel>().Components.Get <IActivationCache>(); }
public WindsorControllerFactory(IKernel kernel) { _kernel = kernel; }
public TaskFactory(IKernel kernel) { this._kernel = kernel; }
private static ISession OpenSession(IKernel kernel) { return(kernel.Resolve <ISessionFactory>().OpenSession()); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IStoreBll>().To <StoreBll>(); kernel.Bind <IArticleBll>().To <ArticleBll>(); }
public NinjectDependencyResolver() { kernel = new StandardKernel(); AddBindings(); }
public static void UseNinjectActivator( this IBootstrapperConfiguration configuration, IKernel kernel) { configuration.UseActivator(new NinjectJobActivator(kernel)); }
public WindsorDependencyScope(IKernel container) { _container = container; _scope = container.BeginScope(); }
public static void Initialize(this IKernel kernel) { kernel.Load(new ToolboxModule(), new DesktopModule()); }
public SportsStoreNinjectDependencyResolver(IKernel kernel) { _kernel = kernel; AddBindings(); }
private static void RegisterServices(IKernel kernel) { System.Web.Mvc.DependencyResolver.SetResolver( new Store.MVC.Infrastructure.NinjectDependencyResolver(kernel)); }
/// <summary> /// Initialize kernel /// </summary> /// <param name="kernel"></param> public void Initialize(IKernel kernel) { _kernel = kernel; }
public SettingsServiceProvider(IKernel kernel) { // This is not lazy, but the core is always going to be using this anyway _instance = kernel.Get <SettingsService>(); }
public HeadUpProgressSheetViewModel(IKernel kernel, IMapper mapper, IProgressSheetService progressSheetService) : base(kernel, mapper, progressSheetService) { }
public AccountController(IKernel kernel) { _kernel = kernel; }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <ISisbgData>().To <SisbgData>(); }
public NinjectIoC() { var settings = new CustomNinjectSettings(new NinjectSettings()); _Kernel = new StandardKernel(settings); }
protected override void Configure(IKernel kernel, BaseCommonConfig commonConfig) { kernel.Rebind <ServiceValidator>().To <MockServiceValidator>().InSingletonScope(); kernel.Bind <ICalculatorService>().To <CalculatorService>().InSingletonScope(); }
/*----------------------------------------------------------------------------------------*/ #region Public Methods /// <summary> /// Connects the strategy to its environment. /// </summary> /// <param name="kernel">The kernel to associate the strategy with.</param> public void Connect(IKernel kernel) { Ensure.NotDisposed(this); Kernel = kernel; OnConnected(new EventArgs()); }
public AccountController(IKernel kernel, IAuthProvider auth) { authProvider = auth; }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <Models.IAmindepedency>().To <Models.Admindepedency>(); kernel.Bind <Models.IUserDependency>().To <Models.Userdependency>(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <ICustomerRepository>().To <CustomerRepositoryXml>(); }
public NinjectServiceLocator(IKernel kernel) { _kernel = kernel; }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IProductsApiService>().To <ProductsApiService>(); kernel.Bind <IProductsRepository>().To <ProductsRepository>(); }
/// <summary> /// Initializes a new instance of the <see cref="CoreXamlTypeInvoker"/> class. /// </summary> /// <param name="kernel">The kernel.</param> /// <param name="typeToResolve">The type to resolve.</param> /// <param name="xamlType">Type of the xaml.</param> public CoreXamlTypeInvoker(IKernel kernel, Type typeToResolve, XamlType xamlType) : base(xamlType) { this.kernel = kernel; this.typeToResolve = typeToResolve; }
public NullDataService(IModelSerializer serializer, GameContent content, IKernel kernel) : base(serializer, content) { }