本文整理汇总了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;
}
示例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);
}
}
};
}
示例3: AbstractTestRunner
public AbstractTestRunner(IServiceLocator services, TestPackage package)
{
Services = services;
TestPackage = package;
TestRunnerFactory = Services.GetService<ITestRunnerFactory>();
ProjectService = Services.GetService<IProjectService>();
}
示例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();
}
示例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;
}
示例6: ExampleHtmlWriter
public ExampleHtmlWriter(IServiceLocator serviceLocator, IUrlRegistry urlRegistry, BehaviorGraph behaviorGraph)
{
_serviceLocator = serviceLocator;
_urlRegistry = urlRegistry;
_behaviorGraph = behaviorGraph;
_examplePageUrl = "_fubu/html/example".ToAbsoluteUrl();
}
示例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);
}
示例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));
}
示例9: SetLocator
public static void SetLocator(IServiceLocator locator)
{
if (locator == null)
throw new ArgumentNullException();
instance = locator;
}
示例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();
}
示例11: Initialize
public override void Initialize(IServiceLocator locator)
{
//Initializácia kodových tabuliek modulu administrácia
locator.GetInstance<AdministrationCodeTableService>()
.Initialize();
}
示例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;
}
示例13: MailService
public MailService(IServiceLocator locator)
{
Contract.Requires(locator != null);
this.Serialization = locator.Resolve<ISerialization<byte[]>>();
this.Repository = locator.Resolve<Func<string, IMailMessage>>();
}
示例14: Execute
/// <summary>
/// Create executor
/// </summary>
public void Execute(Object message, IServiceLocator serviceLocator)
{
if (_shortAction != null)
_shortAction(message);
else
_fullAction(message, serviceLocator);
}
示例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>();
}