public void Register(IKernelInternal kernel)
        {
            // 1. Interceptor Registration
            kernel.Register(
                Component.For <LoggingInterceptor>()
                .ImplementedBy <LoggingInterceptor>());

            // Another Interceptor registration.
            //kernel.Register(
            //    Component.For<AnotherInterceptor>()
            //        .ImplementedBy<AnotherInterceptor>());

            // 2. Interceptor attached with Example Class.
            kernel.Register(
                Component.For <IExample>()
                .ImplementedBy <Example>()
                .Interceptors(InterceptorReference.ForType <LoggingInterceptor>()).Anywhere);

            // Mutiple Interceptors for the same class can be registered with one line as below.
            //kernel.Register(
            //     Component.For<IExample>()
            //                .ImplementedBy<Example>()
            //                .Interceptors(new InterceptorReference[] {
            //                                InterceptorReference.ForType<LoggingInterceptor>(),
            //                                InterceptorReference.ForType<AnotherInterceptor>()
            //     }).Anywhere);
        }
Ejemplo n.º 2
0
        public void Register(IKernelInternal kernel)
        {
            //kernel.Register(
            //    Component.For<SecurityInterceptor>()
            //        .ImplementedBy<SecurityInterceptor>());

            kernel.Register(Component.For <SecurityAspect>());
            kernel.Register(Component.For <LoggingAspect>());



            // Registrer All BLO Objects
            foreach (Type EntityType in new GwinEntitiesManager().GetAll_Entities_Type())
            {
                Type BLOEntity_Type = GwinBaseBLO <BaseEntity> .Detemine_Type_EntityBLO(EntityType, GwinApp.Instance.TypeBaseBLO);


                //   kernel.Register(
                //Component.For(BLOEntity_Type).ImplementedBy(BLOEntity_Type)
                //         .Interceptors(
                //    InterceptorReference.ForType<SecurityInterceptor>()).Anywhere);

                kernel.Register(
                    Component.For(BLOEntity_Type).ImplementedBy(BLOEntity_Type)
                    .Interceptors(
                        typeof(SecurityAspect),
                        typeof(LoggingAspect)));
            }
        }
Ejemplo n.º 3
0
        public void Register(IKernelInternal kernel)
        {
            kernel.Register(Component.For <LoggingInterceptor>().ImplementedBy <LoggingInterceptor>());

            kernel.Register(
                Component.For <ITask>().ImplementedBy <Task>().Interceptors(
                    InterceptorReference.ForType <LoggingInterceptor>()).Anywhere);
            //Anywhere tells the registration process that this interceptor could be attached anywhere.
        }
        public void Register(IKernelInternal kernel)
        {
            kernel.Register(Component.For<LoggingInterceptor>().ImplementedBy<LoggingInterceptor>());

            kernel.Register(
                Component.For<ITask>().ImplementedBy<Task>().Interceptors(
                    InterceptorReference.ForType<LoggingInterceptor>()).Anywhere);
            //Anywhere tells the registration process that this interceptor could be attached anywhere.
        }
Ejemplo n.º 5
0
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(
         Component.For <MethodLoggerInterceptor>()
         .ImplementedBy <MethodLoggerInterceptor>());
     kernel.Register(
         Component.For <IPdfDocumentBuilder>()
         .ImplementedBy <PdfDocumentBuilder>()
         .Interceptors(InterceptorReference.ForType <MethodLoggerInterceptor>()).Anywhere);
 }
Ejemplo n.º 6
0
        public void Register(IKernelInternal kernel)
        {
            kernel.Register(
                Component.For <TestInterceptor>()
                .ImplementedBy <TestInterceptor>());

            kernel.Register(
                Component.For <OrderLogic>()
                .ImplementedBy <OrderLogic>()
                .Interceptors(InterceptorReference.ForType <TestInterceptor>()).Anywhere);
        }
Ejemplo n.º 7
0
        public void Register(IKernelInternal kernel)
        {
            kernel.Register(
                Component.For <LoggingInterceptor>()
                .ImplementedBy <LoggingInterceptor>());

            kernel.Register(
                Component.For <IRocket>()
                .ImplementedBy <Rocket>()
                .Interceptors(InterceptorReference.ForType <LoggingInterceptor>()).Anywhere);
        }
        public void Register(IKernelInternal kernel)
        {
            kernel.Register(
                Component.For <StudentInterceptor>()
                .ImplementedBy <StudentInterceptor>());

            kernel.Register(
                Component.For <IStudent>()
                .ImplementedBy <Student>()
                .Interceptors(InterceptorReference.ForType <StudentInterceptor>()).Anywhere);
        }
Ejemplo n.º 9
0
        public void Register(IKernelInternal kernel)
        {
            kernel.Register(
                Component.For <IInterceptor>()
                .ImplementedBy <ServiceInterceptor>());

            kernel.Register(
                Component.For <IDemoService>()
                .ImplementedBy <DemoService>()
                .Interceptors(InterceptorReference.ForType <ServiceInterceptor>()).Anywhere);
        }
 /// <summary>
 /// Performs the registration in the <see cref="T:Castle.MicroKernel.IKernel"/>.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <IWindowManager, WindowManager>()
                     .LifeStyle.Singleton,
                     Component.For <IEventAggregator, EventAggregator>()
                     .LifeStyle.Singleton);
 }
        public void Register(IKernelInternal kernel)
        {
            kernel.Register(
                Component.For <PageLoggingInterceptor>()
                .ImplementedBy <PageLoggingInterceptor>());


            //Pages registration
            kernel.Register(
                Component.For <IStartPage>()
                .ImplementedBy <StartPage>()
                .Interceptors(InterceptorReference.ForType <PageLoggingInterceptor>()).Anywhere);

            kernel.Register(
                Component.For <IResultsOfSearch>()
                .ImplementedBy <ResultsOfSearch>()
                .Interceptors(InterceptorReference.ForType <PageLoggingInterceptor>()).Anywhere);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Performs the registration in the <see cref="T:Castle.MicroKernel.IKernel"/>.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <IDataService, DataService>()
                     .LifeStyle.Singleton,
                     Component.For <IWorkspaceReaderWriter, WorkspaceReaderWriter>()
                     .LifeStyle.Transient,
                     Component.For <IWorkspaceReader, XmlWorkspaceReader>()
                     .LifeStyle.Transient,
                     Component.For <IWorkspaceWriter, XmlWorkspaceWriter>()
                     .LifeStyle.Transient);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Performs the registration in the <see cref="T:Castle.MicroKernel.IKernel"/>.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <IViewModelFactory, ViewModelFactory>().LifeStyle.Transient,
                     Component.For <ModelEditorLoader>().LifeStyle.Transient,
                     Component.For <SharedDomainLoader>().LifeStyle.Transient,
                     Component.For <ConstraintLoader>().LifeStyle.Transient,
                     Component.For <VariableLoader>().LifeStyle.Transient,
                     Component.For <IWorkspaceLoader, WorkspaceLoader>().LifeStyle.Transient,
                     Component.For <IResourceManager, ResourceManager>().LifeStyle.Singleton,
                     Component.For <IDocumentManager, DocumentManager>().LifeStyle.Singleton);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Performs the registration in the <see cref="T:Castle.MicroKernel.IKernel"/>.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <IShell, ShellViewModel>().LifeStyle.Singleton,
                     Component.For <IMainWindow, MainWindowViewModel>().LifeStyle.Singleton,
                     Component.For <IWorkspaceDocument, WorkspaceDocumentViewModel>().LifeStyle.Transient,
                     Component.For <IWorkspace, WorkspaceViewModel>().LifeStyle.Transient,
                     Component.For <ChessboardTabViewModel>().LifeStyle.Transient,
                     Component.For <IApplicationMenu, ApplicationMenuViewModel>().LifeStyle.Singleton,
                     Component.For <FileMenuViewModel>().LifeStyle.Singleton,
                     Component.For <EditMenuViewModel>().LifeStyle.Singleton,
                     Component.For <InsertMenuViewModel>().LifeStyle.Singleton,
                     Component.For <ModelMenuViewModel>().LifeStyle.Singleton,
                     Component.For <SolutionMenuViewModel>().LifeStyle.Singleton,
                     Component.For <TableMenuViewModel>().LifeStyle.Singleton,
                     Component.For <ITitleBar, TitleBarViewModel>().LifeStyle.Singleton,
                     Component.For <ModelValidatorViewModel>().LifeStyle.Transient,
                     Types.FromThisAssembly().BasedOn <IWorkspaceTabViewModel>());
 }
Ejemplo n.º 15
0
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(
         AllTypes.FromAssembly(Assembly).BasedOn <IController>()
         .LifestyleTransient(),
         AllTypes.FromAssembly(Assembly).BasedOn <ViewComponent>()
         .LifestyleTransient(),
         AllTypes.FromAssembly(Assembly).BasedOn <IFilter>()
         .LifestyleTransient(),
         AllTypes.FromAssembly(Assembly).BasedOn <IDynamicActionProvider>()
         .LifestyleTransient(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPreBind <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPostBind <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPreList))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPostList <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPreSave <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPostSave <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPreCreate <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPostCreate <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPreUpdate <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPostUpdate <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPreView))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(IPostView <>))
         .LifestylePerWebRequest().WithServiceAllInterfaces(),
         AllTypes.FromAssembly(Assembly).BasedOn(typeof(ISiteSearch))
         .LifestylePerWebRequest().WithServiceAllInterfaces()
         );
     Routing.Register(Assembly);
 }
Ejemplo n.º 16
0
        void IRegistration.Register(IKernelInternal kernel)
        {
            foreach (IWcfClientModel channel in channels)
            {
                var registration = Component.For(channel.Contract);
                registration.DependsOn(Property.ForKey("channel").Eq(channel));

                if (configurer != null)
                {
                    configurer(registration);
                }

                if (String.IsNullOrEmpty(registration.Name))
                {
                    registration.Named(Guid.NewGuid().ToString());
                }

                if (!kernel.HasComponent(registration.Name))
                {
                    kernel.Register(registration);
                }
            }
        }
Ejemplo n.º 17
0
		void IRegistration.Register(IKernelInternal kernel)
		{
			foreach (IWcfClientModel channel in channels)
			{
				var registration = Component.For(channel.Contract);
				registration.DependsOn(Property.ForKey("channel").Eq(channel));

				if (configurer != null)
				{
					configurer(registration);
				}

				if (String.IsNullOrEmpty(registration.Name))
				{
					registration.Named(Guid.NewGuid().ToString());
				}

				if (!kernel.HasComponent(registration.Name))
				{
					kernel.Register(registration);
				}
			}
		}
Ejemplo n.º 18
0
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <ILogger>().ImplementedBy <ConsoleLogger>());
 }
Ejemplo n.º 19
0
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(
         Component.For <ISmartCoffeeCup>().ImplementedBy <CoffeeCup>().LifestyleTransient(),
         Component.For <ICoffeeVendingMachine>().ImplementedBy <CoffeeVendingMachine>().LifestyleSingleton());
 }
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For<ILogger>().ImplementedBy<ConsoleLogger>());
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Performs the registration in the <see cref="T:Castle.MicroKernel.IKernel"/>.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <EditSolutionCommand>()
                     .LifeStyle.Transient);
 }
Ejemplo n.º 22
0
		public override void Init(IKernelInternal kernel)
		{
			base.Init(kernel);

			kernel.Register(Component.For<IScopeManager>().Instance(this));
		}
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <Interceptador>().ImplementedBy <Interceptador>());
     kernel.Register(Component.For <IChamado>()
                     .ImplementedBy <Chamado>());
 }
Ejemplo n.º 24
0
        public override void Init(IKernelInternal kernel)
        {
            base.Init(kernel);

            kernel.Register(Component.For <IScopeManager>().Instance(this));
        }
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For <IAnotherExample>().ImplementedBy <AnotherExample>());
 }
 public void Register(IKernelInternal kernel)
 {
     kernel.Register(Component.For<IAnotherExample>().ImplementedBy<AnotherExample>());
 }
Ejemplo n.º 27
0
            public void Register(IKernelInternal kernel)
            {
                kernel.Register(
                    Component
                    .For <ServiceConfig>()
                    .Instance(_config)
                    .LifeStyle.Singleton);

                kernel.Register(
                    Component.For <MethodCallLoggingAdvice>()
                    .ImplementedBy <MethodCallLoggingAdvice>());

                kernel.Register(
                    Component
                    .For <IScanServiceContext>()
                    .UsingFactoryMethod(ConfigureDbContext)
                    .LifeStyle.Transient);

                kernel.Register(
                    Component
                    .For <IResourceMonitor>()
                    .Interceptors <MethodCallLoggingAdvice>()
                    .UsingFactoryMethod(
                        k =>
                {
                    var monitor = new FolderMonitor(
                        k.Resolve <IScanServiceContext>(),
                        _config.FolderScanFrequencySeconds);

                    var handlers = k.ResolveAll <IResourceMonitorEventHandler>();
                    foreach (var handler in handlers)
                    {
                        monitor.ResourceAdded   += handler.ResourceAddedEventHandler;
                        monitor.ResourceChanged += handler.ResourceChangedEventHandler;
                    }

                    return(monitor);
                }));

                kernel.Register(
                    Component.For <IResourceMonitorEventHandler>()
                    .Interceptors <MethodCallLoggingAdvice>()
                    .UsingFactoryMethod(
                        _ => new ResourceStreamingHandler(
                            new MessageSequenceBuilder(),
                            new ServiceBusQueueMessageSender(
                                _config.DataQueueConnectionString,
                                _config.DataQueueName),
                            () => _config.MessageMaxSizeBytes))
                    .LifeStyle.Transient);

                kernel.Register(
                    Component.For <IAvailabilityCheck>()
                    .Interceptors <MethodCallLoggingAdvice>()
                    .UsingFactoryMethod(
                        _ => new AvailabilityCheck(
                            new ServiceBusQueueMessageSender(
                                _config.MonitoringQueueConnectionString,
                                _config.MonitoringQueueName),
                            ConfigureDbContext(),
                            _config.ClientId,
                            _config.AvailabilityCheckFrequencySeconds))
                    .LifeStyle.Transient);

                kernel.Register(
                    Component.For <IMessageReceiver>()
                    .Interceptors <MethodCallLoggingAdvice>()
                    .UsingFactoryMethod(
                        _ => new ServiceBusSubscriptionMessageReceiver(
                            _config.ConfigTopicConnectionString,
                            _config.ConfigTopicName,
                            _config.ConfigTopicSubscriptionName))
                    .LifeStyle.Transient);

                kernel.Register(
                    Component.For <IExternalConfigurationProvider>()
                    .ImplementedBy(typeof(ExternalConfigurationProvider))
                    .Interceptors <MethodCallLoggingAdvice>()
                    .LifeStyle.Transient);
            }