Example #1
0
 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();
 }
 private void RegisterIMappingEngine(IKernel kernel)
 {
     kernel.Register(
         Component.For<IMappingEngine>()
             .UsingFactoryMethod(k => new MappingEngine(kernel.Resolve<IConfigurationProvider>()))
     );
 }
Example #3
0
 /// <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>();
 }
		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);
		}
        public override void Register(IKernel kernel)
        {
            AddFacility<FactorySupportFacility>(kernel);

            RegisterIConfigurationProviderAndIProfileExpression(kernel);
            RegisterIMappingEngine(kernel);
        }
Example #6
0
        /// <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 void Init(IKernel kernel, Castle.Core.Configuration.IConfiguration facilityConfig)
		{
			Assert.IsNotNull(kernel);
			Assert.IsNotNull(facilityConfig);

			Initialized = true;
		}
 public ProductVariantModelBinder(ISetVariantTypeProperties setVariantTypeProperties, ISetRestrictedShippingMethods setRestrictedShippingMethods, ISetETagService setETagService, IKernel kernel)
     : base(kernel)
 {
     _setVariantTypeProperties = setVariantTypeProperties;
     _setRestrictedShippingMethods = setRestrictedShippingMethods;
     _setETagService = setETagService;
 }
		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);
		}
Example #10
0
 public static void Configure(IKernel kernel)
 {
     kernel.Load(new []
     {
         new ConfigurationModule(), 
     });
 }
Example #11
0
 /// <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>
		/// 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;
		}
Example #13
0
 public ParticlesTest(IKernel kernel, ContentManager content, GraphicsDevice device)
     : base("Particles", kernel)
 {
     _kernel = kernel;
     _content = content;
     _device = device;
 }
		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>
		///   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;
		}
 public ActiveFeatureFactory(IKernel kernel, IInstanceConfiguration instanceConfiguration, ILog log, ILoggingConfiguration loggingConfiguration)
 {
     _kernel = kernel;
     _instanceConfiguration = instanceConfiguration;
     _log = log;
     _loggingConfiguration = loggingConfiguration;
 }
		/// <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)
 {
     kernel.Bind<RestContext>().ToSelf().InRequestScope();
     kernel.Bind<IRecipeRepository>().To<RecipeRepository>().InRequestScope();
     kernel.Bind<ILanguageProvider>().To<LanguageProvider>().InRequestScope();
     kernel.Bind<IRestaurantRepository>().To<RestaurantRepository>().InRequestScope();
 }
Example #19
0
        /// <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();
        }
 /// <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>();
 }
Example #21
0
        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"]);
        }
Example #22
0
        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", "[email protected]")

                .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>();
        }
Example #23
0
 /// <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>
		/// 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);
		}
 private void RegisterIConfigurationProviderAndIProfileExpression(IKernel kernel)
 {
     kernel.Register(
         Component.For<IConfigurationProvider, IProfileExpression>()
             .UsingFactoryMethod(k => new Configuration(MapperRegistry.AllMappers()))
     );
 }
Example #26
0
 public MessageHandler(IKernel kernel, ITransport transport, ISerializer serializer, TimeoutManager timeoutManager)
 {
     m_kernel = kernel;
     m_transport = transport;
     m_serializer = serializer;
     m_timeoutManager = timeoutManager;
 }
Example #27
0
 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);
 }
Example #28
0
 public TextTest(IKernel kernel, GraphicsDevice device, ContentManager content)
     : base("Text Test", kernel)
 {
     _kernel = kernel;
     _device = device;
     _content = content;
 }
Example #29
0
 /// <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 CheckKernel()
 {
     if (Kernel != null)
         return;
     Kernel = ServiceRegistry.Current as IKernel;
     Guard.NotNull(Kernel, "Kernal");
 }