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


C# IServiceLocator.RegisterType方法代码示例

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


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

示例1: Initialize

        /// <summary>
        /// Initializes the specified service locator.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        public void Initialize(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => serviceLocator);

            serviceLocator.RegisterTypeIfNotYetRegistered<IBootstrapperTaskFactory, BootstrapperTaskFactory>();

            serviceLocator.RegisterType<RegionAdapterMappings, RegionAdapterMappings>();
            serviceLocator.RegisterType<IUICompositionService, UICompositionService>();
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:13,代码来源:ExtensionsPrismModule.cs

示例2: OnStartup

        //private static readonly ILog log = LogManager.GetLogger(typeof (Program)) ;
        


        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            _versionNumber = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            _log.InfoFormat("Starting Safe and Sound 2015 version {0}", _versionNumber);


            base.OnStartup(e);
#if DEBUG
            Catel.Logging.LogManager.RegisterDebugListener();
           
#endif

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            // TODO: Using a custom IoC container like Unity? Register it here:
            //Catel.IoC.ServiceLocator.Instance.RegisterExternalContainer(MyUnityContainer);

            _serviceLocator = ServiceLocator.Default;
            _serviceLocator.RegisterType<IBackupSetService, BackupSetService>();
            _serviceLocator.RegisterType<IMessageBoxService, MessageBoxService>();
            _serviceLocator.RegisterInstance<ILog>(_log);
            var test = _serviceLocator.GetService(typeof(ILog));
            //test.l

            var uiVisualizerService = _serviceLocator.ResolveType<IUIVisualizerService>();
            uiVisualizerService.Register(typeof(BackupSetViewModel), typeof(BackupSetDialog));
            uiVisualizerService.Register(typeof(ExcludedDirectoriesViewModel), typeof(ExcludedDirectoriesWindow));
            uiVisualizerService.Register(typeof(DriveSelectionViewModel), typeof(DriveSelectionWindow));
            uiVisualizerService.Register(typeof(AboutViewModel), typeof(AboutDialog));

            

            

            var typeFactory = this.GetTypeFactory();
            var shellWindowViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion<MainWindowViewModel>();
            shellWindowViewModel.OnThemeChanged += shellWindowViewModel_OnThemeChanged;

            new SKnoxConsulting.SafeAndSound.Gui.Views.MainWindow(shellWindowViewModel).ShowDialog();

           // Bootstrapper bootstrapper = new Bootstrapper();
           // bootstrapper.Run();



            
        }
开发者ID:simon-knox,项目名称:SafeAndSound2014,代码行数:55,代码来源:App.xaml.cs

示例3: RegisterServices

        /// <summary>
        /// Registers the services in the specified <see cref="IServiceLocator" />.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="serviceLocator"/> is <c>null</c>.</exception>
        public static void RegisterServices(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => serviceLocator);

            serviceLocator.RegisterTypeIfNotYetRegistered<IBootstrapperTaskFactory, BootstrapperTaskFactory>();

            serviceLocator.RegisterType<RegionAdapterMappings, RegionAdapterMappings>();
        }
开发者ID:paytonli2013,项目名称:Catel,代码行数:13,代码来源:ExtensionsPrismModule.cs

示例4: Initialize

        /// <summary>
        /// Initializes the specified service locator.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        public void Initialize(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => serviceLocator);

            serviceLocator.RegisterType<ILanguageService, LanguageService>();
            serviceLocator.RegisterInstance<IExceptionService>(ExceptionService.Default);
            serviceLocator.RegisterInstance<IMessageMediator>(MessageMediator.Default);

            serviceLocator.RegisterType<IValidatorProvider, AttributeValidatorProvider>();
            serviceLocator.RegisterType<IRegistrationConventionHandler, RegistrationConventionHandler>();

#if NET
            serviceLocator.RegisterType<IBinarySerializer, BinarySerializer>();
#endif

            serviceLocator.RegisterType<IDataContractSerializerFactory, DataContractSerializerFactory>();
            serviceLocator.RegisterType<IXmlSerializer, XmlSerializer>();
            serviceLocator.RegisterType<IXmlNamespaceManager, XmlNamespaceManager>();
            serviceLocator.RegisterType<ISerializationManager, SerializationManager>();

            serviceLocator.RegisterType<IModelEqualityComparer, ModelEqualityComparer>();
            serviceLocator.RegisterType<IConfigurationService, ConfigurationService>();
        }
开发者ID:JaysonJG,项目名称:Catel,代码行数:27,代码来源:CoreModule.cs

示例5: RegisterServices

        /// <summary>
        /// Registers the services in the specified <see cref="IServiceLocator" />.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="serviceLocator"/> is <c>null</c>.</exception>
        public static void RegisterServices(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => serviceLocator);

            serviceLocator.RegisterInstance<IExceptionService>(ExceptionService.Default);
            serviceLocator.RegisterInstance<IMessageMediator>(MessageMediator.Default);

            serviceLocator.RegisterTypeIfNotYetRegistered<IValidatorProvider, AttributeValidatorProvider>();

#if NET
            serviceLocator.RegisterType<IBinarySerializer, BinarySerializer>();
#endif

            serviceLocator.RegisterType<IDataContractSerializerFactory, DataContractSerializerFactory>();
            serviceLocator.RegisterType<IXmlSerializer, XmlSerializer>();
            serviceLocator.RegisterType<IXmlNamespaceManager, XmlNamespaceManager>();
            serviceLocator.RegisterType<ISerializationManager, SerializationManager>();

            serviceLocator.RegisterType<IModelEqualityComparer, ModelEqualityComparer>();
        }
开发者ID:paytonli2013,项目名称:Catel,代码行数:25,代码来源:CoreModule.cs

示例6: Initialize

        /// <summary>
        /// Initializes the specified service locator.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        public void Initialize(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull("serviceLocator", serviceLocator);

            serviceLocator.RegisterType<ILanguageService, LanguageService>();
            serviceLocator.RegisterInstance<IExceptionService>(ExceptionService.Default);
            serviceLocator.RegisterInstance<IMessageMediator>(MessageMediator.Default);

            serviceLocator.RegisterType<IValidatorProvider, AttributeValidatorProvider>();
            serviceLocator.RegisterType<IRegistrationConventionHandler, RegistrationConventionHandler>();

#if NET
            serviceLocator.RegisterType<IBinarySerializer, BinarySerializer>();
            serviceLocator.RegisterTypeWithTag<ISerializationContextInfoFactory, BinarySerializationContextInfoFactory>(typeof(BinarySerializer));
#endif
            serviceLocator.RegisterType<IDataContractSerializerFactory, DataContractSerializerFactory>();
            serviceLocator.RegisterType<IXmlSerializer, XmlSerializer>();
            serviceLocator.RegisterType<IXmlNamespaceManager, XmlNamespaceManager>();
            serviceLocator.RegisterType<ISerializationManager, SerializationManager>();
            serviceLocator.RegisterType<IObjectAdapter, ObjectAdapter>();

            serviceLocator.RegisterType<ISerializer, XmlSerializer>();
            serviceLocator.RegisterTypeWithTag<ISerializationContextInfoFactory, XmlSerializationContextInfoFactory>(typeof(XmlSerializer));

            serviceLocator.RegisterType<IModelEqualityComparer, ModelEqualityComparer>();
            serviceLocator.RegisterType<IConfigurationService, ConfigurationService>();
            serviceLocator.RegisterType<IObjectConverterService, ObjectConverterService>();
            serviceLocator.RegisterType<IRollingInMemoryLogService, RollingInMemoryLogService>();
        }
开发者ID:Catel,项目名称:Catel,代码行数:33,代码来源:CoreModule.cs

示例7: Configure

 /// <summary>
 /// Configures an instance of <see cref="IServiceLocator" />.
 /// </summary>
 /// <param name="serviceLocator">The instance of <see cref="IServiceLocator" /></param>
 public void Configure(IServiceLocator serviceLocator)
 {
     foreach (Registration registrationElement in this)
     {
         serviceLocator.RegisterType(registrationElement.InterfaceType, registrationElement.ImplementationType, registrationElement.Tag, registrationElement.RegistrationType);
     }
 }
开发者ID:jensweller,项目名称:Catel,代码行数:11,代码来源:ServiceLocatorConfiguration.cs

示例8: SetUp

            public void SetUp()
            {
                _regionManagerMock = new Mock<IRegionManager>();
                _activeViewCollection = new Mock<IViewsCollection>();
                _viewCollection = new Mock<IViewsCollection>();
                _regionCollectionMock = new Mock<IRegionCollection>();
                _mainRegionMock = new Mock<IRegion>();

                var dispatcherServiceMock = new Mock<IDispatcherService>();
                dispatcherServiceMock.Setup(service => service.Invoke(It.IsAny<Action>())).Callback((Action action) => action.Invoke());

                _serviceLocator = ServiceLocator.Default;
                _serviceLocator.RegisterInstance<IDispatcherService>(dispatcherServiceMock.Object);

                _serviceLocator.RegisterType<IViewLocator, ViewLocator>();
                _serviceLocator.RegisterType<IViewModelLocator, ViewModelLocator>();
                _serviceLocator.RegisterType<IUIVisualizerService, UIVisualizerService>();
                _serviceLocator.RegisterType<IUICompositionService, UICompositionService>();
            }
开发者ID:yshbchenlie,项目名称:Catel,代码行数:19,代码来源:UIVisualizerServiceExtensionsTests.cs

示例9: Initialize

        /// <summary>
        /// Initializes the specified service locator.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        public void Initialize(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => serviceLocator);

            serviceLocator.RegisterType<IJsonSerializer, JsonSerializer>();
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:10,代码来源:SerializationJsonModule.cs

示例10: Initialize

        /// <summary>
        /// Initializes the specified service locator.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        public void Initialize(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => serviceLocator);

            serviceLocator.RegisterType<IProxyFactory, ProxyFactory>();
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:10,代码来源:ExtensionsInterceptionModule.cs

示例11: RegisterServices

 private void RegisterServices(IServiceLocator serviceLocator)
 {
     serviceLocator.RegisterType<IReflectionService, ReflectionService>();
     serviceLocator.RegisterType<IUIServiceHost, UIServiceHost>();
     serviceLocator.RegisterType<ITestTargetService, TestTargetService>();
     serviceLocator.RegisterType<ISettings, Settings>();
 }
开发者ID:rexwhitten,项目名称:NUnitBenchmarker,代码行数:7,代码来源:App.xaml.cs

示例12: Configure

 /// <summary>
 /// Configures an instance of <see cref="IServiceLocator" />.
 /// </summary>
 /// <param name="serviceLocator">The instance of <see cref="IServiceLocator" /></param>
 public void Configure(IServiceLocator serviceLocator)
 {
     serviceLocator.SupportDependencyInjection = SupportDependencyInjection;
     foreach (Registration registrationElement in this)
     {
         serviceLocator.RegisterType(registrationElement.InterfaceType, registrationElement.ImplementationType, registrationElement.Tag, registrationElement.RegistrationType);
     }
 }
开发者ID:paytonli2013,项目名称:Catel,代码行数:12,代码来源:ServiceLocatorConfiguration.cs

示例13: RegisterServices

        /// <summary>
        /// Registers the services in the specified <see cref="IServiceLocator" />.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="serviceLocator"/> is <c>null</c>.</exception>
        public static void RegisterServices(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => serviceLocator);

            serviceLocator.RegisterType<IProxyFactory, ProxyFactory>();
        }
开发者ID:paytonli2013,项目名称:Catel,代码行数:11,代码来源:ExtensionsInterceptionModule.cs


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