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


C# IServiceLocator.GetService方法代码示例

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


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

示例1: AbstractTestRunner

 public AbstractTestRunner(IServiceLocator services, TestPackage package)
 {
     Services = services;
     TestPackage = package;
     TestRunnerFactory = Services.GetService<ITestRunnerFactory>();
     ProjectService = Services.GetService<IProjectService>();
 }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:7,代码来源:AbstractTestRunner.cs

示例2: RootRoute

 public RootRoute(bool blogAggregationEnabled, IRouteHandler normalRouteHandler, IRouteHandler aggRouteHandler,
     IServiceLocator serviceLocator)
 {
     BlogAggregationEnabled = blogAggregationEnabled;
     NormalRouteHandler = normalRouteHandler ??
                          new PageRouteHandler("~/aspx/Dtp.aspx", serviceLocator.GetService<ISubtextPageBuilder>(), serviceLocator);
     AggregateRouteHandler = aggRouteHandler ??
                             new PageRouteHandler("~/aspx/AggDefault.aspx", serviceLocator.GetService<ISubtextPageBuilder>(), serviceLocator);
 }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:9,代码来源:RootRoute.cs

示例3: MasterTestRunner

        public MasterTestRunner(IServiceLocator services, TestPackage package)
        {
            _services = services;
            TestPackage = package;

            _testRunnerFactory = _services.GetService<ITestRunnerFactory>();
            _projectService = _services.GetService<IProjectService>();
            _runtimeService = _services.GetService<IRuntimeFrameworkService>();
            _extensionService = _services.GetService<ExtensionService>();
            _engineRunner = _testRunnerFactory.MakeTestRunner(package);
        }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:11,代码来源:MasterTestRunner.cs

示例4: 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

示例5: OnAfterRegisterServices

        protected override void OnAfterRegisterServices(IServiceLocator serviceLocator)
        {
            base.OnAfterRegisterServices(serviceLocator);

            // Populate users
            var userService = serviceLocator.GetService<IUserService>();
            userService.CreateUser(userService.CreateSignUpInfo("Tom", "TomsPassword", "[email protected]"));
            userService.CreateUser(userService.CreateSignUpInfo("Aleksas", "AleksasPassword", "[email protected]"));
            userService.CreateUser(userService.CreateSignUpInfo("Mike", "MikesPassword", "[email protected]"));

            // Populate categories
            throw new NotImplementedException();
            //var categoryService = (CategoryService)serviceLocator.GetService<ICategoryService>();
            //using (var categoryReader = new WikipediaCategoryCursor())
            //    categoryService.AddCategories(categoryReader);

            // Populate messages
            var messageService = serviceLocator.GetService<IMessageService>();
        }
开发者ID:Aleksask,项目名称:Altitude,代码行数:19,代码来源:WikipediaChatAppFactory.cs

示例6: SystemDirectoryRoute

 public SystemDirectoryRoute(string directoryName, IServiceLocator serviceLocator)
     : base(directoryName + "/{*pathInfo}", new DirectoryRouteHandler(serviceLocator.GetService<ISubtextPageBuilder>(), serviceLocator))
 {
     DirectoryName = directoryName;
 }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:5,代码来源:SystemDirectoryRoute.cs

示例7: CachingUnitTest

 public CachingUnitTest()
 {
     iServiceLocate = ServiceLocatorFactory.GetServiceLocator();
     iTestService = iServiceLocate.GetService<ITestService>();
 }
开发者ID:QeeWu,项目名称:CCNUnitTests,代码行数:5,代码来源:CachingUnitTest.cs

示例8: AuditTrailUnitTest

 public AuditTrailUnitTest()
 {
     //iAuditTrailManagementService = ServiceLocatorFactory.GetServiceLocator().GetService<IAuditTrailManagementService>();
     iServiceLocate = ServiceLocatorFactory.GetServiceLocator();
     iTestService = iServiceLocate.GetService<ITestService>();
 }
开发者ID:Chinaccn,项目名称:surfboard,代码行数:6,代码来源:AuditTrailUnitTest.cs

示例9: Initialize

        /// <summary>
        /// Initializes REST Foundation configuration with the default IoC container.
        /// </summary>
        /// <param name="serviceLocator">A service locator instance.</param>
        /// <returns>The configuration options object.</returns>
        public RestOptions Initialize(IServiceLocator serviceLocator)
        {
            if (serviceLocator == null)
            {
                throw new ArgumentNullException("serviceLocator");
            }

            if (ServiceLocator != null)
            {
                throw new InvalidOperationException(Resources.Global.AlreadyConfigured);
            }

            RouteCollection routes = RouteTable.Routes;
            routes.Add(new Route(String.Empty, serviceLocator.GetService<RootRouteHandler>()));

            ServiceLocator = serviceLocator;

            m_options = new RestOptions();
            return m_options;
        }
开发者ID:dstarosta,项目名称:GitProjects,代码行数:25,代码来源:Rest.cs

示例10: Configure

 protected override async Task Configure(IServiceLocator locator, ConfigurationData configuration)
 {
   var logger = await locator.GetService<ILogger>();
   logger.Trace("Configured test 'module one'");
 }
开发者ID:alexrster,项目名称:QX.NodeParty,代码行数:5,代码来源:ModuleOneDescriptor.cs

示例11: OnAfterRegisterServices

        protected override void OnAfterRegisterServices(IServiceLocator serviceLocator)
        {
            base.OnAfterRegisterServices(serviceLocator);

            // Populate users
            var userService = serviceLocator.GetService<IUserService>();
            userService.CreateUser(userService.CreateSignUpInfo("Tom", "TomsPassword", "[email protected]"));
            userService.CreateUser(userService.CreateSignUpInfo("Aleksas", "AleksasPassword", "[email protected]"));
            userService.CreateUser(userService.CreateSignUpInfo("Mike", "MikesPassword", "[email protected]"));

            // Populate categories
            var categoryService = serviceLocator.GetService<ICategoryService>();
            categoryService.CreateCategory(GetCategoryInfo());

            // Populate messages
            var messageService = serviceLocator.GetService<IMessageService>();
        }
开发者ID:Aleksask,项目名称:Altitude,代码行数:17,代码来源:BasicChatAppFactory.cs

示例12: PageRoute

 public PageRoute(string url, string virtualPath, IEnumerable<string> controls, IServiceLocator serviceLocator)
     : this(url, virtualPath, controls, serviceLocator.GetService<ISubtextPageBuilder>(), serviceLocator)
 {
 }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:4,代码来源:PageRoute.cs


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