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


C# IServiceLocator类代码示例

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


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

示例1: GetInstance

 /// <summary>
 /// Get IServiceLocator instace.
 /// </summary>
 /// <returns></returns>
 public static IServiceLocator GetInstance()
 {
     if (singletonServiceLocator == null) {
         singletonServiceLocator = new AbstractServiceLocator ();
     }
     return singletonServiceLocator;
 }
开发者ID:jioe,项目名称:appverse-mobile,代码行数:11,代码来源:AbstractServiceLocator.cs

示例2: ServiceLocatorAutoRegistrationManager

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocatorAutoRegistrationManager" /> class.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="serviceLocator"/> is <c>null</c>.</exception>
        public ServiceLocatorAutoRegistrationManager(IServiceLocator serviceLocator)
        {
            Argument.IsNotNull("serviceLocator", serviceLocator);

            _serviceLocator = serviceLocator;

            if (EnvironmentHelper.IsProcessCurrentlyHostedByTool())
            {
                return;
            }

            TypeCache.AssemblyLoaded += (sender, args) =>
            {
                foreach (var type in args.LoadedTypes)
                {
                    _pendingTypes.Enqueue(type);
                }

                if (_autoRegisterTypesViaAttributes)
                {
                    try
                    {
                        InspectLoadedAssemblies();
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "Failed to handle dynamically loaded assembly '{0}'", args.Assembly.FullName);
                    }
                }
            };
        }
开发者ID:jensweller,项目名称:Catel,代码行数:36,代码来源:ServiceLocatorAutoRegistrationManager.cs

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

示例4: XmlMessageSerializer

 	public XmlMessageSerializer(IReflection reflection, IServiceLocator serviceLocator )
     {
         this.reflection = reflection;
         this.serviceLocator = serviceLocator;
     	customElementSerializers = this.serviceLocator.ResolveAll<ICustomElementSerializer>().ToArray();
 		elementSerializationBehaviors = this.serviceLocator.ResolveAll<IElementSerializationBehavior>().ToArray();
     }
开发者ID:JackWangCUMT,项目名称:rhino-esb,代码行数:7,代码来源:XmlMessageSerializer.cs

示例5: ApplicationController

 public ApplicationController(IShellView shellView, IServiceLocator serviceLocator)
 {
     if (shellView == null) throw new ArgumentNullException("shellView");
     if (serviceLocator == null) throw new ArgumentNullException("serviceLocator");
     this.shellView = shellView;
     this.serviceLocator = serviceLocator;
 }
开发者ID:jenrom,项目名称:LogSpy,代码行数:7,代码来源:ApplicationController.cs

示例6: ExampleHtmlWriter

 public ExampleHtmlWriter(IServiceLocator serviceLocator, IUrlRegistry urlRegistry, BehaviorGraph behaviorGraph)
 {
     _serviceLocator = serviceLocator;
     _urlRegistry = urlRegistry;
     _behaviorGraph = behaviorGraph;
     _examplePageUrl = "_fubu/html/example".ToAbsoluteUrl();
 }
开发者ID:nhsevidence,项目名称:fubumvc,代码行数:7,代码来源:ExampleHtmlWriter.cs

示例7: Setup

        internal static void Setup(IServiceLocator locator, ProviderConfiguration config)
        {
            var factories = config.Datastores.Cast<Datastore>().Select(LoadFactory);
            var proxy = new UnitOfWorkFactoryProxy(factories);

            locator.Inject<IUnitOfWorkFactory>(proxy);
        }
开发者ID:brendanhay,项目名称:Shared,代码行数:7,代码来源:DataBootstrapper.cs

示例8: RegisterHandlers

 private static void RegisterHandlers(IServiceLocator serviceLocator)
 {
     var registrar = new BusRegistrar(serviceLocator);
     registrar.Register(typeof(CartHandlers));
     registrar.Register(typeof(CartViewProjections));
     registrar.Register(typeof(CustomerCreatedEventHandler));
 }
开发者ID:petarkorudzhiev,项目名称:d3es,代码行数:7,代码来源:Bootstrapper.cs

示例9: SetLocator

			public static void SetLocator(IServiceLocator locator)
			{
				if (locator == null)
					throw new ArgumentNullException();

				instance = locator;
			}
开发者ID:ArildF,项目名称:Smeedee,代码行数:7,代码来源:ServiceLocator.cs

示例10: EventMigratorManager

 /// <summary>
 /// Initializes an instance of <see cref="EventMigratorManager">EventMigratorManager</see>
 /// </summary>
 /// <param name="typeDiscoverer"></param>
 /// <param name="serviceLocator"></param>
 public EventMigratorManager(ITypeDiscoverer typeDiscoverer, IServiceLocator serviceLocator)
 {
     _typeDiscoverer = typeDiscoverer;
     _serviceLocator = serviceLocator;
     _migratorTypes = new Dictionary<Type, Type>();
     Initialize();
 }
开发者ID:TormodHystad,项目名称:Bifrost,代码行数:12,代码来源:EventMigratorManager.cs

示例11: Initialize

 public override void Initialize(IServiceLocator locator)
 {
     //Initializácia kodových tabuliek modulu administrácia
     locator.GetInstance<AdministrationCodeTableService>()
         .Initialize();
     
 }
开发者ID:aytacozkan,项目名称:nisproject,代码行数:7,代码来源:Configuration.cs

示例12: TurbineControllerActivator

        /// <summary>
        /// Default constructor for the type
        /// </summary>
        /// <param name="serviceLocator"></param>
        public TurbineControllerActivator(IServiceLocator serviceLocator) {
            if (serviceLocator == null) {
                throw new ArgumentNullException("serviceLocator");
            }

            ServiceLocator = serviceLocator;
        }
开发者ID:calebjenkins,项目名称:mvcturbine,代码行数:11,代码来源:TurbineControllerActivator.cs

示例13: MailService

        public MailService(IServiceLocator locator)
        {
            Contract.Requires(locator != null);

            this.Serialization = locator.Resolve<ISerialization<byte[]>>();
            this.Repository = locator.Resolve<Func<string, IMailMessage>>();
        }
开发者ID:nutrija,项目名称:revenj,代码行数:7,代码来源:MailService.cs

示例14: Execute

 /// <summary>
 /// Create executor 
 /// </summary>
 public void Execute(Object message, IServiceLocator serviceLocator)
 {
     if (_shortAction != null)
         _shortAction(message);
     else
         _fullAction(message, serviceLocator);
 }
开发者ID:paralect,项目名称:Paralect.ServiceBus,代码行数:10,代码来源:DelegateHandler.cs

示例15: 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<IConnectionStringManager, ConnectionStringManager>();
            serviceLocator.RegisterTypeIfNotYetRegistered<IContextFactory, ContextFactory>();
        }
开发者ID:JaysonJG,项目名称:Catel,代码行数:11,代码来源:ExtensionsEntityFramework6Module.cs


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