/// <summary> /// Creates new instance of <see cref="SampleTypeSetProvider"/> /// </summary> /// <param name="testErrorFactoryResolver">test error factory resolver</param> public SampleTypeSetProvider(IServiceResolver<IInfoEntityFactory<TestError>> testErrorFactoryResolver) { if (testErrorFactoryResolver == null) throw new MemoryPointerIsNullException("testErrorFactoryResolver"); this.sampleTypes = LoadSampleTypes(testErrorFactoryResolver); }
/// <summary> /// Creates new instance of <see cref="SampleUserTokenProvider"/> /// </summary> /// <param name="sampleUserTokenFactoryResolver">sample user token factory resolver</param> public SampleUserTokenProvider(IServiceResolver<ISampleUserTokenFactory> sampleUserTokenFactoryResolver) { if (sampleUserTokenFactoryResolver == null) throw new MemoryPointerIsNullException("sampleUserTokenFactoryResolver"); this.sampleUserTokenFactoryResolver = sampleUserTokenFactoryResolver; }
/// <summary> /// Creates new instance of <see cref="SampleUserTokenFactory"/> /// </summary> /// <param name="utcTimeProviderResolver">UTC time provider resolver</param> public SampleUserTokenFactory(IServiceResolver<IUTCTimeProvider> utcTimeProviderResolver) { if (utcTimeProviderResolver == null) throw new MemoryPointerIsNullException("utcTimeProviderResolver"); this.utcTimeProviderResolver = utcTimeProviderResolver; }
/// <summary> /// Initializes a new instance of the <see cref="DependencyInjectionServiceHost"/> class. /// </summary> /// <param name="serviceResolver"></param> /// <param name="serviceType">Type of the service.</param> /// <param name="baseAddresses">The base addresses.</param> public IoCServiceHost(IServiceResolver serviceResolver, System.Type serviceType, Uri[] baseAddresses) : base(serviceType, baseAddresses) { //Register the service as a type so it can be found from the instance provider _serviceResolver.Register(serviceType); _serviceResolver = serviceResolver; }
/// <summary> /// Creates new instance of <see cref="AttendeeProvider"/> /// </summary> /// <param name="delegateProviderResolver">delegate provider resolver</param> public AttendeeProvider(IServiceResolver<IDelegateProvider> delegateProviderResolver) { if (delegateProviderResolver == null) throw new MemoryPointerIsNullException("delegateProviderResolver"); var delegateProvider = ((ServiceResolver<IDelegateProvider>) delegateProviderResolver).Service; this.attendees = LoadAttendees(delegateProvider); }
public static void TestProcessScriptGenerator(IServiceResolver sr) { var pr = sr.GetInstance<IProcessPackageRepo>(); var pdef = pr.GetProcessDef("Test2.Compensation.1"); var sw = new StringWriter(); NGinnBPM.Runtime.ProcessDSL.BooProcessScriptGenerator gen = new NGinnBPM.Runtime.ProcessDSL.BooProcessScriptGenerator(sw); gen.GenerateScript(pdef); Console.WriteLine(sw.ToString()); }
/// <summary> /// Creates new instance of <see cref="Services"/> /// </summary> /// <param name="delegateProviderResolver">delegate provider resolver</param> public Services(IServiceResolver<IDelegateProvider> delegateProviderResolver) { if (delegateProviderResolver == null) throw new MemoryPointerIsNullException("delegateProviderResolver"); var attendeeProviderResolver = new ServiceResolver<IAttendeeProvider>(new AttendeeProvider(delegateProviderResolver)); var meetingProviderResolver = new ServiceResolver<IMeetingProvider>(new MeetingProvider(delegateProviderResolver, attendeeProviderResolver)); this.Bundle.AddServiceResolver(attendeeProviderResolver); this.Bundle.AddServiceResolver(meetingProviderResolver); }
/// <summary> /// Creates new instance of <see cref="SampleType"/> /// </summary> /// <param name="initData">initialization data</param> internal SampleType(SampleTypeInitData initData) { if (initData == null) throw new MemoryPointerIsNullException("initData"); initData.ValidatePropertiesNotNull(); this.Name = initData.Name; this.Count = initData.Count; this.testErrorFactoryResolver = initData.TestErrorFactoryResolver; }
public IList<IService> Resolve(IServiceResolver resolver, string protocol, TimeSpan timeout, int minServiceCountFound, int maxServiceCountFound) { resolver.ServiceFound += new ObjectEvent<IService>(resolver_ServiceFound); resolver.ServiceRemoved += new ObjectEvent<IService>(resolver_ServiceRemoved); resolver.Resolve(protocol); for (int i = minServiceCountFound; i <= maxServiceCountFound; i++) syncLock.WaitOne(timeout); resolver.ServiceFound -= resolver_ServiceFound; resolver.ServiceRemoved -= resolver_ServiceRemoved; return services; }
/// <summary> /// Creates new instance of <see cref="SampleTypeStructuredDataProvider"/> /// </summary> /// <param name="setProviderResolver">set provider resolver</param> /// <param name="structureProviderResolver">structure provider resolver</param> public SampleTypeStructuredDataProvider(IServiceResolver<ISampleTypeSetProvider> setProviderResolver, IServiceResolver<ISampleTypeStructureProvider> structureProviderResolver) { if (setProviderResolver == null) throw new MemoryPointerIsNullException("setProviderResolver"); if (structureProviderResolver == null) throw new MemoryPointerIsNullException("structureProviderResolver"); this.setProviderResolver = setProviderResolver; this.structureProviderResolver = structureProviderResolver; }
/// <summary> /// Creates new instance of <see cref="ContextProvider"/> /// </summary> /// <param name="contextInitData">context initialization data</param> /// <param name="userDataProvider">user data provider</param> public ContextProvider(ContextInitData contextInitData, IServiceResolver<IUserDataProvider> userDataProviderResolver) { if (contextInitData == null) throw new MemoryPointerIsNullException("contextInitData"); if (userDataProviderResolver == null) throw new MemoryPointerIsNullException("userDataProviderResolver"); this.contextInitData = contextInitData; this.userDataProviderResolver = userDataProviderResolver; }
/// <summary> /// Creates new instance of <see cref="SampleContextProvider"/> /// </summary> /// <param name="contextInitData">context initialization data</param> /// <param name="userDataProviderResolver">user data provider resolver</param> /// <param name="meetingProviderResolver">meeting provider resolver</param> public SampleContextProvider( ContextInitData contextInitData, IServiceResolver<IUserDataProvider> userDataProviderResolver, IServiceResolver<IMeetingProvider> meetingProviderResolver) : base(contextInitData, userDataProviderResolver) { if (meetingProviderResolver == null) throw new MemoryPointerIsNullException("meetingProviderResolver"); this.meetingProviderResolver = meetingProviderResolver; }
/// <summary> /// Creates new instance of <see cref="MeetingProvider"/> /// </summary> /// <param name="delegateProviderResolver">delegate provider resolver</param> /// <param name="attendeeProviderResolver">attendee provider resolver</param> public MeetingProvider(IServiceResolver<IDelegateProvider> delegateProviderResolver, IServiceResolver<IAttendeeProvider> attendeeProviderResolver) { if (delegateProviderResolver == null) throw new MemoryPointerIsNullException("delegateProviderResolver"); if (attendeeProviderResolver == null) throw new MemoryPointerIsNullException("attendeeProviderResolver"); this.delegateProviderResolver = delegateProviderResolver; this.attendeeProviderResolver = attendeeProviderResolver; this.meetings = LoadMeetings(delegateProviderResolver, attendeeProviderResolver); }
/// <summary> /// Creates new instance of <see cref="Context"/> /// </summary> /// <param name="initData">initialization data</param> public Context(ContextInitData initData) { if (initData == null) throw new MemoryPointerIsNullException("initData"); initData.ValidatePropertiesNotNull(); this.UTCTimeProviderResolver = initData.UTCTimeProviderResolver; this.localTimeOffsetProviderResolver = initData.LocalTimeOffsetProviderResolver; this.UICultureProviderResolver = initData.UICultureProviderResolver; this.items = new Dictionary<string, object>(); }
/// <summary> /// Creates new instance of <see cref="Services"/> /// </summary> /// <param name="utcTimeProviderResolver">UTC time provider resolver</param> public Services(IServiceResolver<IUTCTimeProvider> utcTimeProviderResolver) { if (utcTimeProviderResolver == null) throw new MemoryPointerIsNullException("utcTimeProviderResolver"); var sampleUserTokenFactoryResolver = new ServiceResolver<ISampleUserTokenFactory>(new SampleUserTokenFactory(utcTimeProviderResolver)); var userTokenProviderResolver = new ServiceResolver<IUserTokenProvider>(new SampleUserTokenProvider(sampleUserTokenFactoryResolver)); var userDataProviderResolver = new ServiceResolver<IUserDataProvider>(new SampleUserDataProvider()); var currentUserTokenProviderResolver = new ServiceResolver<ICurrentUserTokenProvider>(new SampleCurrentUserTokenProvider()); this.Bundle.AddServiceResolver(sampleUserTokenFactoryResolver); this.Bundle.AddServiceResolver(userTokenProviderResolver); this.Bundle.AddServiceResolver(userDataProviderResolver); this.Bundle.AddServiceResolver(currentUserTokenProviderResolver); }
/// <summary> /// Creates new instance of <see cref="Services"/> /// </summary> /// <param name="contextInitData">context initialization data</param> /// <param name="userDataProviderResolver">user data provider resolver</param> /// <param name="meetingProviderResolver">meeting provider resolver</param> public Services(ContextInitData contextInitData, IServiceResolver<IUserDataProvider> userDataProviderResolver, IServiceResolver<IMeetingProvider> meetingProviderResolver) { if (contextInitData == null) throw new MemoryPointerIsNullException("contextInitData"); if (userDataProviderResolver == null) throw new MemoryPointerIsNullException("userDataProviderResolver"); if (meetingProviderResolver == null) throw new MemoryPointerIsNullException("meetingProviderResolver"); var contextProvider = new SampleContextProvider(contextInitData, userDataProviderResolver, meetingProviderResolver); this.Bundle.AddServiceResolver(new ServiceResolver<ISampleContextProvider>(contextProvider)); }
private static Dictionary<string, SampleType> LoadSampleTypes(IServiceResolver<IInfoEntityFactory<TestError>> testErrorFactoryResolver) { var result = new Dictionary<string, SampleType>(); result.Add("First name", new SampleType(new SampleTypeInitData() { Name = "First name", Count = 1, TestErrorFactoryResolver = testErrorFactoryResolver, })); result.Add("Second name", new SampleType(new SampleTypeInitData() { Name = "Second name", Count = 2, TestErrorFactoryResolver = testErrorFactoryResolver, })); return result; }
/// <summary> /// Constructor /// </summary> /// <param name="transport">Message transport used as a backend for this message bus</param> public MessageBus(IMessageTransport transport, IMessageDispatcher dispatcher, ISerializeMessages serializer, IServiceResolver serviceResolver) { log = LogManager.GetLogger("BUS_" + transport.Endpoint); log.Info("Message Bus {0} created", transport.Endpoint); MessageSerializer = serializer; Dispatcher = dispatcher; ServiceLocator = serviceResolver; _transport = transport; _transport.OnMessageArrived += new MessageArrived(_transport_OnMessageArrived); _transport.OnMessageToUnknownDestination += new MessageArrived(_transport_OnMessageToUnknownDestination); SubscriptionService = new DummySubscriptionService(); BatchOutgoingMessagesInTransaction = true; MessageHandlerTransactionScopeOption = TransactionScopeOption.Required; UseTransactionScope = true; DefaultSubscriptionLifetime = TimeSpan.FromHours(48); PublishLocalByDefault = true; }
public static void TestProcess(string definitionId, IServiceResolver container, Action<CompositeTaskInstanceInfo, Dictionary<string, object>> validate) { using (var ts = new TransactionScope()) { var pr = container.GetInstance<ProcessEngine>(); var proc = pr.StartProcess(definitionId, new Dictionary<string, object> { }); log.Info("Started process {0}: {1}", definitionId, proc); var ti = pr.GetTaskInstanceInfo(proc); var data = pr.GetTaskData(proc); if (validate != null) { validate(ti, data); } /* if (ti.Status != NGinnBPM.Runtime.TaskStatus.Completed) { throw new Exception("Process did not complete"); }*/ ts.Complete(); } }
public static void SetServiceResolver(IServiceResolver serviceResolver) { Current = serviceResolver; }
/// <summary> /// Creates a lifetime manager for the service lifetime. /// </summary> /// <param name="resolver">the calling resolver</param> /// <returns>the <see cref="ILifetimeManager"/> instance</returns> public ILifetimeManager CreateManager(IServiceResolver resolver) => ManagerFactory(resolver);
public DependencyResolverAdapter(IServiceResolver resolver) { _resolver = resolver; }
/// <summary> /// Specifies the <see cref="IServiceResolver"/> to use. /// </summary> /// <param name="serviceResolver">The <see cref="IServiceResolver"/> to use.</param> /// <returns> /// The current <see cref="MessagingBusBuilder"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="serviceResolver"/> is <see langword="null"/>. /// </exception> public MessagingBusBuilder WithServiceResolver(IServiceResolver serviceResolver) { ServiceResolver = serviceResolver ?? throw new ArgumentNullException(nameof(serviceResolver)); return(this); }
public MessageDispatcher(IServiceResolver resolver) { ServiceLocator = resolver; log = LogManager.GetLogger("MessageDispatcher_" + this.GetHashCode()); RequireHandler = false; }
public ServiceScope(IServiceResolver serviceResolver) { _serviceResolver = serviceResolver; }
public CycleProtector(IServiceResolver wrappee) : base(wrappee) { typesStack = new List <Type>(); }
public WeatherClientTyped(HttpClient httpClient, ILogger <WeatherClientTyped> logger, IServiceResolver serviceResolver) { _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); this.logger = logger; this.serviceResolver = serviceResolver; }
public DefaultAutoSubscriberMessageDispatcher(IServiceResolver resolver) { this.resolver = resolver; }
public ServiceProcessPipelineFactory(IServiceResolver resolver, PipelineSegment <TRequest, TProcessRequest, TProcessResponse, TResponse> tail) { _resolver = resolver; _tail = tail; }
public ServiceResolverScope(IServiceResolver resolver) { this.resolver = resolver; }
public void RemoveResolver(IServiceResolver resolver) { resolvers.Add(resolver); resolver.ServiceFound -= resolver_ServiceFound; resolver.ServiceRemoved -= resolver_ServiceRemoved; }
public ServiceRouter(IServiceResolver resolver) { _resolver = resolver; }
/// <summary> /// Assign your own implementation /// </summary> /// <param name="factory">Factory to use</param> public void Assign(IServiceResolver factory) { if (factory == null) throw new ArgumentNullException("factory"); _instance = new ServiceResolver(factory); }
public CompoundServiceResolver(ServiceBuilderServiceResolver serviceBuilderResolver, IServiceResolver serviceResolver) { _serviceBuilderResolver = serviceBuilderResolver; _serviceResolver = serviceResolver; }
public ServiceProvider(IServiceResolver serviceResolver) { _serviceResolver = serviceResolver; }
private ServiceResolver(IServiceResolver serviceResolver) { _resolver = serviceResolver; }
internal static Service CreateLazyService <Service, Impl>(this ProxyGenerator proxyGen, IServiceResolver resolver) where Service : class where Impl : class, Service { var proxy = proxyGen.CreateInterfaceProxyWithTargetInterface(typeof(ILazyServiceFaker), new[] { typeof(Service) }, SingletonFaker, new ServiceInterceptor <Impl>(resolver)); return(proxy as Service); }
public DisposedProxyGenerator(IServiceResolver serviceResolver) { _serviceResolver = serviceResolver; _proxyGenerator = serviceResolver.ResolveRequired <IProxyGenerator>(); }
/// <summary> /// Create a new instance of <see cref="AspectCoreServiceResolver"/>. /// </summary> /// <param name="resolver"></param> public AspectCoreServiceResolver(IServiceResolver resolver) { _resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); }
/// <summary> /// Creates a HandlerMiddlewareBuilder instance. /// </summary> /// <param name="handlerResolver">An <see cref="IHandlerResolver"/> that can create handlers.</param> /// <param name="serviceResolver">An <see cref="IServiceResolver"/> that enables resolution of middlewares /// and middleware services.</param> public HandlerMiddlewareBuilder(IHandlerResolver handlerResolver, IServiceResolver serviceResolver) { ServiceResolver = serviceResolver; HandlerResolver = handlerResolver; _middlewares = new List <Func <HandleMessageMiddleware> >(); }
public DatabaseService(IServiceResolver serviceResolver, IConfiguratorService configuratorService, IClockService clockService) { this.serviceResolver = serviceResolver; this.configuratorService = configuratorService; this.clockService = clockService; }
public DependencyInjector(IServiceResolver resolver) { ServiceResolver = resolver; }
/// <summary> /// Supply an implementation of IServiceResolver that will be used for creating message handlers /// and sagas. This way you can manage the lifetime of your message handlers in an external container /// and you don't have to register them in nginn-messagebus config. /// You have to implement the following method of your IServiceResolver: /// - HasService /// - GetAllInstances /// - GetInstance /// - ReleaseInstance /// </summary> /// <param name="externalResolver"></param> /// <returns></returns> public MessageBusConfigurator UseExternalHandlerContainer(IServiceResolver externalResolver) { _wc.Register(Component.For <IServiceResolver>().Instance(externalResolver).Named("ExternalServiceResolver")); return(this); }
public BllController(IServiceResolver scope) { this._scope = scope; _dateTimeBLL = _scope.Resolve <DateTimeBLL>(); }
public ExtendDependencyResolver(IServiceResolver resolver) { _resolver = resolver; }
/// <summary> /// 注册服务解析器 /// </summary> /// <param name="resolver"></param> public void RegisterResolver(IServiceResolver resolver) { this.resolver = resolver; }
public HelloServiceModule(IServiceResolver serviceResolver) : base(serviceResolver) {}
public RabbitAdvancedBus( IConnectionFactory connectionFactory, IConsumerFactory consumerFactory, IClientCommandDispatcherFactory clientCommandDispatcherFactory, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IServiceResolver container, ConnectionConfiguration connectionConfiguration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, AdvancedBusEventHandlers advancedBusEventHandlers, IPersistentConnectionFactory persistentConnectionFactory) { Preconditions.CheckNotNull(connectionFactory, "connectionFactory"); Preconditions.CheckNotNull(consumerFactory, "consumerFactory"); Preconditions.CheckNotNull(eventBus, "eventBus"); Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory"); Preconditions.CheckNotNull(container, "container"); Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy"); Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration"); Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); Preconditions.CheckNotNull(persistentConnectionFactory, "persistentConnectionFactory"); this.consumerFactory = consumerFactory; this.confirmationListener = confirmationListener; this.eventBus = eventBus; this.handlerCollectionFactory = handlerCollectionFactory; this.Container = container; this.connectionConfiguration = connectionConfiguration; this.produceConsumeInterceptor = produceConsumeInterceptor; this.messageSerializationStrategy = messageSerializationStrategy; this.Conventions = conventions; this.eventBus.Subscribe <ConnectionCreatedEvent>(e => OnConnected()); if (advancedBusEventHandlers.Connected != null) { Connected += advancedBusEventHandlers.Connected; } this.eventBus.Subscribe <ConnectionDisconnectedEvent>(e => OnDisconnected()); if (advancedBusEventHandlers.Disconnected != null) { Disconnected += advancedBusEventHandlers.Disconnected; } this.eventBus.Subscribe <ConnectionBlockedEvent>(OnBlocked); if (advancedBusEventHandlers.Blocked != null) { Blocked += advancedBusEventHandlers.Blocked; } this.eventBus.Subscribe <ConnectionUnblockedEvent>(e => OnUnblocked()); if (advancedBusEventHandlers.Unblocked != null) { Unblocked += advancedBusEventHandlers.Unblocked; } this.eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned); if (advancedBusEventHandlers.MessageReturned != null) { MessageReturned += advancedBusEventHandlers.MessageReturned; } connection = persistentConnectionFactory.CreateConnection(); clientCommandDispatcher = clientCommandDispatcherFactory.GetClientCommandDispatcher(connection); connection.Initialize(); }
/// <summary> /// Assign a new service resolver implementation. /// </summary> /// <param name="serviceResolver">Resolver to use.</param> public static void Assign(IServiceResolver serviceResolver) { if (serviceResolver == null) throw new ArgumentNullException("serviceResolver"); _serviceResolver = serviceResolver; }
/// <summary> /// Creates new instance of <see cref="UserContext"/> /// </summary> /// <param name="initData">initialization data</param> public MeetingContext(MeetingContextInitData initData) : base(initData) { this.CurrentMeetingId = initData.CurrentMeetingId; this.meetingProviderResolver = initData.MeetingProviderResolver; }
private static Dictionary<int, Meeting> LoadMeetings(IServiceResolver<IDelegateProvider> delegateProviderResolver, IServiceResolver<IAttendeeProvider> attendeeProviderResolver) { var result = new Dictionary<int, Meeting>(); result.Add(1, new Meeting(new MeetingInitData() { Id = 1, Name = "First meeting", StartTime = DateTime.Now.AddDays(1), EndTime = DateTime.Now.AddDays(1).AddHours(1), OrganizerDelegateId = 1, DelegateProviderResolver = delegateProviderResolver, AttendeeProviderResolver = attendeeProviderResolver, })); result.Add(2, new Meeting(new MeetingInitData() { Id = 2, Name = "Second meeting", StartTime = DateTime.Now.AddDays(-1), EndTime = DateTime.Now.AddDays(-1).AddHours(1), OrganizerDelegateId = 2, DelegateProviderResolver = delegateProviderResolver, AttendeeProviderResolver = attendeeProviderResolver, })); return result; }
/// <summary> /// Creates new instance of <see cref="YetAnotherTypeStructuredDataProvider"/> /// </summary> /// <param name="setProviderResolver">set provider resolver</param> /// <param name="structureProviderResolver">structure provider resolver</param> public YetAnotherTypeStructuredDataProvider(IServiceResolver <IYetAnotherTypeSetProvider> setProviderResolver, IServiceResolver <IYetAnotherTypeStructureProvider> structureProviderResolver) { if (setProviderResolver == null) { throw new MemoryPointerIsNullException("setProviderResolver"); } if (structureProviderResolver == null) { throw new MemoryPointerIsNullException("structureProviderResolver"); } this.setProviderResolver = setProviderResolver; this.structureProviderResolver = structureProviderResolver; }
public MasterDispatcherServlet(IServiceResolver resolver) { _resolver = resolver; }
public ITask GetInitializer(IServiceResolver resolver) { return(resolver.TaskFactory.FromEnumerableAction(Init)); }
public void UseResolver(IServiceResolver serviceResolver) { _serviceResolver = serviceResolver; }
public SupportRequiredService(IServiceResolver serviceResolver) { _serviceResolver = serviceResolver; }
public DefaultController(IAuthorizationService authorizationService, IServiceResolver serviceResolver) { this.authorizationService = authorizationService; this.serviceResolver = serviceResolver; }