/// <summary> /// Initializes a new instance of the <see cref="EditorViewLocator"/> class. /// </summary> /// <param name="services">The service container.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="services"/> is <see langword="null"/>. /// </exception> public EditorViewLocator(IServiceLocator services) { if (services == null) throw new ArgumentNullException(nameof(services)); _services = services; }
/// <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>(); }
public TransportActivator(ChannelGraph graph, IServiceLocator services, IHandlerPipeline pipeline, IEnumerable<ITransport> transports) { _graph = graph; _services = services; _pipeline = pipeline; _transports = transports; }
/// <summary> /// Get IServiceLocator instace. /// </summary> /// <returns></returns> public static IServiceLocator GetInstance() { if (singletonServiceLocator == null) { singletonServiceLocator = new AbstractServiceLocator (); } return singletonServiceLocator; }
public AbstractTestRunner(IServiceLocator services, TestPackage package) { Services = services; TestPackage = package; TestRunnerFactory = Services.GetService<ITestRunnerFactory>(); ProjectService = Services.GetService<IProjectService>(); }
/// <summary> /// Initialises a new instance of <see cref="CSLExportProvider" />. /// </summary> /// <param name="serviceLocator"></param> public CSLExportProvider(IServiceLocator serviceLocator) { Throw.IfArgumentNull(serviceLocator, "serviceLocator"); this.serviceLocator = serviceLocator; this.contractMapping = new Dictionary<string, Type>(); }
/// <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); } } }; }
//-------------------------------------------------------------- #region Creation & Cleanup //-------------------------------------------------------------- public ProceduralTerrainObject(IServiceLocator services) { if (services == null) throw new ArgumentNullException("services"); _services = services; }
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; }
/// <summary> /// Initializes a new instance of the <see cref="DbAccessProvider" /> class. /// </summary> /// <param name="dbAccessProviders"> /// The db access providers. /// </param> /// <param name="serviceLocator"> /// The service locator. /// </param> public DbAccessProvider(IIndex<string, IDbAccess> dbAccessProviders, IServiceLocator serviceLocator) { this._dbAccessProviders = dbAccessProviders; this._serviceLocator = serviceLocator; this._providerName = Config.ConnectionProviderName; this._dbAccessSafe = new SafeReadWriteProvider<IDbAccess>( () => { IDbAccess dbAccess; // attempt to get the provider... if (this._dbAccessProviders.TryGetValue(this.ProviderName, out dbAccess)) { // first time... this._serviceLocator.Get<IRaiseEvent>().Raise(new InitDatabaseProviderEvent(this.ProviderName, dbAccess)); } else { throw new NoValidDbAccessProviderFoundException( @"Unable to Locate Provider Named ""{0}"" in Data Access Providers (DLL Not Located in Bin Directory?).".FormatWith( this.ProviderName)); } return dbAccess; }); }
public XmlMessageSerializer(IReflection reflection, IServiceLocator serviceLocator ) { this.reflection = reflection; this.serviceLocator = serviceLocator; customElementSerializers = this.serviceLocator.ResolveAll<ICustomElementSerializer>().ToArray(); elementSerializationBehaviors = this.serviceLocator.ResolveAll<IElementSerializationBehavior>().ToArray(); }
public ContainerSwitcher(IServiceLocator newContainer, bool shouldDisposeContainerWhenDone) { originalContainer = EnterpriseLibraryContainer.Current; shouldDisposeNewContainer = shouldDisposeContainerWhenDone; EnterpriseLibraryContainer.Current = newContainer; }
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); }
/// <summary> /// Initializes the specified service locator. /// </summary> /// <param name="serviceLocator">The service locator.</param> public void Initialize(IServiceLocator serviceLocator) { Argument.IsNotNull(() => serviceLocator); serviceLocator.RegisterTypeIfNotYetRegistered<IDataContextSubscriptionService, DataContextSubscriptionService>(); serviceLocator.RegisterTypeIfNotYetRegistered<ICommandManager, CommandManager>(); serviceLocator.RegisterTypeIfNotYetRegistered<IViewLoadManager, ViewLoadManager>(); serviceLocator.RegisterTypeIfNotYetRegistered<IViewModelWrapperService, ViewModelWrapperService>(); serviceLocator.RegisterTypeIfNotYetRegistered<IViewManager, ViewManager>(); serviceLocator.RegisterTypeIfNotYetRegistered<IViewModelManager, ViewModelManager>(); serviceLocator.RegisterTypeIfNotYetRegistered<IAutoCompletionService, AutoCompletionService>(); #if !XAMARIN && !WIN80 serviceLocator.RegisterTypeIfNotYetRegistered<IInteractivityManager, InteractivityManager>(); #endif ViewModelServiceHelper.RegisterDefaultViewModelServices(serviceLocator); // Don't use property, we cannot trust the cached property here yet in Visual Studio if (CatelEnvironment.GetIsInDesignMode()) { foreach (var assembly in AssemblyHelper.GetLoadedAssemblies()) { var attributes = assembly.GetCustomAttributesEx(typeof (DesignTimeCodeAttribute)); foreach (var attribute in attributes) { // No need to do anything } } } }
public ExampleHtmlWriter(IServiceLocator serviceLocator, IUrlRegistry urlRegistry, BehaviorGraph behaviorGraph) { _serviceLocator = serviceLocator; _urlRegistry = urlRegistry; _behaviorGraph = behaviorGraph; _examplePageUrl = "_fubu/html/example".ToAbsoluteUrl(); }
public HttpServer(ILogFactory logFactory, IServiceLocator locator) { Logger = logFactory.Create("Http server"); Listener = new HttpListener(); Listener.IgnoreWriteExceptions = true; foreach (string key in ConfigurationManager.AppSettings.Keys) { if (key.StartsWith("HttpAddress", StringComparison.InvariantCultureIgnoreCase)) Listener.Prefixes.Add(ConfigurationManager.AppSettings[key]); } if (Listener.Prefixes.Count == 0) { Listener.Prefixes.Add("http://*:80/"); Listener.Prefixes.Add("https://*:443/"); } Routes = new Routes(locator); var customAuth = ConfigurationManager.AppSettings["CustomAuth"]; if (!string.IsNullOrEmpty(customAuth)) { var authType = Type.GetType(customAuth); if (!typeof(HttpAuth).IsAssignableFrom(authType)) throw new ConfigurationErrorsException("Custom auth does not inherit from HttpAuth. Please inherit from " + typeof(HttpAuth).FullName); Authentication = locator.Resolve<HttpAuth>(authType); } else Authentication = locator.Resolve<HttpAuth>(); }
/// <summary> /// Create executor /// </summary> public void Execute(Object message, IServiceLocator serviceLocator) { if (_shortAction != null) _shortAction(message); else _fullAction(message, serviceLocator); }
public void Execute(IServiceLocator serviceLocator) { Execute( serviceLocator.GetInstance<IWindowManager>(), serviceLocator.GetInstance<IQuestionDialog>() ); }
private void RegisterRhinoQueuesTransport(AbstractRhinoServiceBusConfiguration c, IBusContainerBuilder b, IServiceLocator l) { var busConfig = c.ConfigurationSection.Bus; var fileManagerConfiguration = new QueueManagerConfiguration(); b.RegisterSingleton<ISubscriptionStorage>(() => (ISubscriptionStorage)new FileSubscriptionStorage( busConfig.SubscriptionPath, l.Resolve<IMessageSerializer>(), l.Resolve<IReflection>())); b.RegisterSingleton<ITransport>(() => (ITransport)new RhinoFilesTransport( c.Endpoint, l.Resolve<IEndpointRouter>(), l.Resolve<IMessageSerializer>(), c.ThreadCount, busConfig.QueuePath, c.IsolationLevel, c.NumberOfRetries, busConfig.EnablePerformanceCounters, l.Resolve<IMessageBuilder<MessagePayload>>(), fileManagerConfiguration)); b.RegisterSingleton<IMessageBuilder<MessagePayload>>(() => (IMessageBuilder<MessagePayload>)new RhinoFilesMessageBuilder( l.Resolve<IMessageSerializer>(), l.Resolve<IServiceLocator>())); b.RegisterSingleton<QueueManagerConfiguration>(() => fileManagerConfiguration); }
/// <summary> /// Queries the <see cref="IServiceLocator"/> instance for any instances of <see cref="IFilterRegistry"/> to process. /// </summary> /// <param name="serviceLocator">Current <see cref="IServiceLocator"/> instance for the application.</param> public virtual void SetupFilterRegistries(IServiceLocator serviceLocator) { var filterRegistries = GetFilterRegistries(serviceLocator); if (filterRegistries == null) return; var filterList = new List<Filter>(); var typeList = new List<Type>(); foreach (var filterRegistry in filterRegistries) { var registrations = filterRegistry.GetFilterRegistrations(); using (serviceLocator.Batch()) { foreach (var registration in registrations) { var filterType = registration.FilterType; // Prevent double registration of the same filter if (typeList.Contains(filterType)) continue; serviceLocator.Register(filterType, filterType); typeList.Add(filterType); } } filterList.AddRange(registrations); } typeList.Clear(); FilterProviders.Providers.Add(new FilterRegistryProvider(serviceLocator, filterList)); }
public BehaviorGraphWriter(BehaviorGraph graph, IUrlRegistry urls, IServiceLocator services) { _graph = graph; _urls = urls; _services = services; _diagnosticsNamespace = GetType().Namespace; }
/// <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>(); }
private static void RegisterHandlers(IServiceLocator serviceLocator) { var registrar = new BusRegistrar(serviceLocator); registrar.Register(typeof(CartHandlers)); registrar.Register(typeof(CartViewProjections)); registrar.Register(typeof(CustomerCreatedEventHandler)); }
private static void Initialize() { var profile = new AutoMapperProfile(); Mapper.AddProfile(profile); Mapper.AssertConfigurationIsValid(profile.ProfileName); Database.DefaultConnectionFactory = new ConnectionFactory(Database.DefaultConnectionFactory); Database.SetInitializer<SketchDbContext>(null); Database.SetInitializer<EventStoreDbContext>(null); using (var sketchDbContext = new SketchDbContext()) using (var eventStoreDbContext = new EventStoreDbContext()) { if (!sketchDbContext.Database.Exists()) { ((IObjectContextAdapter)sketchDbContext).ObjectContext.CreateDatabase(); eventStoreDbContext.Database.ExecuteSqlCommand(((IObjectContextAdapter)eventStoreDbContext).ObjectContext.CreateDatabaseScript()); } } var container = new UnityContainer(); var unityServiceLocator = new UnityServiceLocator(container); Microsoft.Practices.ServiceLocation.ServiceLocator.SetLocatorProvider(() => unityServiceLocator); ServiceLocator = Microsoft.Practices.ServiceLocation.ServiceLocator.Current; new Core.Module().Init(container); new Module().Init(container); }
/// <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(); }
/// <summary> /// Default constructor for the type /// </summary> /// <param name="serviceLocator"></param> public TurbineControllerActivator(IServiceLocator serviceLocator) { if (serviceLocator == null) { throw new ArgumentNullException("serviceLocator"); } ServiceLocator = serviceLocator; }
public override void Initialize(IServiceLocator locator) { //Initializácia kodových tabuliek modulu administrácia locator.GetInstance<AdministrationCodeTableService>() .Initialize(); }
public static void SetLocator(IServiceLocator locator) { if (locator == null) throw new ArgumentNullException(); instance = locator; }
public MailService(IServiceLocator locator) { Contract.Requires(locator != null); this.Serialization = locator.Resolve<ISerialization<byte[]>>(); this.Repository = locator.Resolve<Func<string, IMailMessage>>(); }
public CatelWebApiDependencyResolver(IServiceLocator serviceLocator) { Argument.IsNotNull(() => serviceLocator); _serviceLocator = serviceLocator; _typeFactory = serviceLocator.ResolveType<ITypeFactory>(); }
public EnterpriseLibraryContainer(IServiceLocator locator) { this.locator = locator; }
public static void RegisterServiceLocator(IServiceLocator s) { Instance = s; }
public ProcessRunner(IServiceLocator services, TestPackage package) : base(services, package) { _agency = Services.GetService <TestAgency>(); }
public UsersController(IServiceLocator serviceLocator) : base(serviceLocator) { }
public FactoryActor(IServiceLocator serviceLocator, IEventQueueOperator queueOperator) { _queueOperator = queueOperator; _serviceLocator = serviceLocator; }
/// <summary> /// Initializes a new instance of the <see cref="Friends"/> class. /// </summary> /// <param name="serviceLocator"> /// The service locator. /// </param> public Friends([NotNull] IServiceLocator serviceLocator) { this.ServiceLocator = serviceLocator; }
protected BaseRepository(string collectionName, IServiceLocator serviceLocator) { mongoClient = serviceLocator.Resolve <IMongoClient>(); mongoDatabase = mongoClient.GetDatabase(AppSettings.UserCollectionName); collection = mongoDatabase.GetCollection <TModel>(collectionName); }
public EchoServiceClient(ICredential credential, CancellationToken token, IServiceLocator serviceLocator) { this.ServiceLocator = serviceLocator; }
/// <summary> /// The get. /// </summary> /// <param name="serviceLocator"> /// The service locator. /// </param> /// <typeparam name="TService"> /// </typeparam> /// <returns> /// The <see cref="TService"/>. /// </returns> public static TService Get <TService>([NotNull] this IServiceLocator serviceLocator) { CodeContracts.VerifyNotNull(serviceLocator, "serviceLocator"); return((TService)serviceLocator.Get(typeof(TService))); }
public TfsExplorerBar(IServiceLocator serviceLocator) : base(serviceLocator) { LoadLogicalBranches(); SubscribeToEvent <Interfaces.Events.NewRootBranchEventData>(NewRootBranchEventHandler); }
/// <summary> /// Initializes a new instance of the <see cref="SpamCheck"/> class. /// </summary> /// <param name="serviceLocator"> /// The service locator. /// </param> public SpamCheck(IServiceLocator serviceLocator) { this.ServiceLocator = serviceLocator; }
public Module(IUnityContainer unityContainer, IServiceLocator serviceLocator) { this.unityContainer = unityContainer; this.serviceLocator = serviceLocator; }
public static void SetCurrent(IServiceLocator item) { Current = item; }
/// <summary> /// The is yaf context. /// </summary> /// <param name="serviceLocator"> /// The service locator. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public static bool IsYafContext([NotNull] this IServiceLocator serviceLocator) { CodeContracts.VerifyNotNull(serviceLocator, "serviceLocator"); return(serviceLocator.Tag == (object)YafLifetimeScope.Context); }
/// <summary> /// Construtor padrão /// </summary> /// <param name="locator">Inteface de IoC</param> /// <param name="typeSchema">Classe de recuperação de metadados</param> /// <param name="translator">Instancia do tradutor.</param> public GenericPersistenceExecuter(IServiceLocator locator, ITypeSchema typeSchema, IQueryTranslator translator) : base(locator, typeSchema) { _translator = translator; }
/// <summary> /// Initializes a new instance of the <see cref="YafBBCode"/> class. /// </summary> /// <param name="serviceLocator"> /// The service locator. /// </param> /// <param name="processReplaceRulesFactory"> /// The process replace rules factory. /// </param> public YafBBCode( IServiceLocator serviceLocator, Func <IEnumerable <bool>, IProcessReplaceRules> processReplaceRulesFactory) { this.ServiceLocator = serviceLocator; this.ProcessReplaceRulesFactory = processReplaceRulesFactory; }
public ServiceLocatorDependencyResolver(IServiceLocator serviceLocator) { _serviceLocator = serviceLocator; }
public CommandBusMiddlewareFactory(IServiceLocator serviceLocator) { this.serviceLocator = serviceLocator; }
public EfRepositoryBase(IServiceLocator serviceLocator) : base(serviceLocator) { }
public AsyncEventQueueDispatcherTests() { asyncEventQueueManager = Substitute.For <IAsyncEventQueueManager>(); serviceLocator = Substitute.For <IServiceLocator>(); sut = new AsyncEventQueueDispatcher(asyncEventQueueManager, serviceLocator); eventSequencers.Add(Substitute.For <IAsyncEventSequencer <Event1> >()); eventSequencers.Add(Substitute.For <IAsyncEventSequencer <Event1> >()); serviceLocator.GetAll(typeof(IAsyncEventSequencer <Event1>)).Returns(eventSequencers); eventMessages = new List <IEventMessage>() { new EventMessage <Event1>(new Event1(), new Dictionary <string, string>()), new EventMessage <Event1>(new Event1(), new Dictionary <string, string>()) }; eventSequencers[0].GetEventSequencing(eventMessages[0]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue1", EventSequenceNumber = 1 }, new EventSequencing() { SequenceName = "queue2", EventSequenceNumber = 1 }, }); eventSequencers[0].GetEventSequencing(eventMessages[1]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue1", EventSequenceNumber = 2 }, new EventSequencing() { SequenceName = "queue2", EventSequenceNumber = 2 }, }); eventSequencers[0].ShouldAttemptSynchronousDispatch(null).ReturnsForAnyArgs(true); eventSequencers[1].GetEventSequencing(eventMessages[0]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue1", EventSequenceNumber = 1 } }); eventSequencers[1].GetEventSequencing(eventMessages[1]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue3", EventSequenceNumber = 3 } }); eventSequencers[1].ShouldAttemptSynchronousDispatch(eventMessages[0]).ReturnsForAnyArgs(true); eventSequencers[1].ShouldAttemptSynchronousDispatch(eventMessages[1]).ReturnsForAnyArgs(false); }
/// <summary> /// Initializes a new instance of the <see cref="AspNetRolesHelper"/> class. /// </summary> /// <param name="serviceLocator"> /// The service locator. /// </param> public AspNetRolesHelper([NotNull] IServiceLocator serviceLocator) { this.ServiceLocator = serviceLocator; }
public DefaultBreadCrumbsFinder(IFubuRequest fubuRequest, IServiceLocator serviceLocator, ICmsContext cmsContext) { _fubuRequest = fubuRequest; _serviceLocator = serviceLocator; _cmsContext = cmsContext; }
public MasterTestRunner(IServiceLocator services, TestPackage package) : base(services, package) { _runtimeService = Services.GetService <IRuntimeFrameworkService>(); _extensionService = Services.GetService <ExtensionService>(); }
public TestableVehicleController(GetUserByClaimId userServices, IServiceLocator serviceLocator) : base(userServices, serviceLocator) { }
/// <summary> /// Registers the with service locator. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="service">The service.</param> /// <param name="locator">The locator.</param> /// <returns></returns> public static Lazy <IServiceLocator> RegisterWithServiceLocator <T>(this Lazy <IServiceLocator> service, IServiceLocator locator) where T : class, IServiceLocator { ServiceLocatorManager.GetSetupDescriptor(service).RegisterWithServiceLocator <T>(service, locator, null); return(service); }
public KatanaHostingActivator(KatanaSettings settings, FubuRouteTable routes, IUrlRegistry urls, IServiceLocator services) { _settings = settings; _routes = routes.Routes; _urls = urls; _services = services; }
/// <summary> /// Construct a RemoteTestAgent /// </summary> public RemoteTestAgent(Guid agentId, string agencyUrl, IServiceLocator services) : base(agentId, services) { _agencyUrl = agencyUrl; }
/// <summary> /// Registers the with service locator. /// </summary> /// <param name="service">The service.</param> /// <param name="locator">The locator.</param> /// <param name="name">The name.</param> /// <returns></returns> public static Lazy <IServiceLocator> RegisterWithServiceLocator(this Lazy <IServiceLocator> service, IServiceLocator locator, string name) { ServiceLocatorManager.GetSetupDescriptor(service).RegisterWithServiceLocator(service, locator, name); return(service); }
public void Initialize(InitializationEngine context) { _locator = context.Locate.Advanced; OrderContext.Current.OrderGroupUpdated += Current_OrderGroupUpdated; }
public void SetTestServiceLocator(IServiceLocator theLocator) { }