public QueriesFactory(IErrorsInbox errorsInbox, IErrorsInbox backendErrorsInbox, IErrorsBacklog errorsBacklog, IErrorsBacklogReader errorsBacklogReader, IVisibilityPublisher visibilityPublisher, IVisibilityPersistor visibilityPersistor, IFrontendNotifier frontendNotifier, params Func <IFrontendQuery>[] subscriptors) { _errorsInbox = errorsInbox; _backendErrorsInbox = backendErrorsInbox; _errorsBacklog = errorsBacklog; _errorsBacklogReader = errorsBacklogReader; _visibilityPublisher = visibilityPublisher; _visibilityPersistor = visibilityPersistor; _frontendNotifier = frontendNotifier; _subscriptors = subscriptors; }
public static T Prepare <T>(this IRegistry registry, IFrontendNotifier frontendNotifier, Func <string, IErrorsInbox, IVisibilityPersistor, IBackendNotifier> frontendBackendNotifierCreator, Func <IBackendNotifier> backendFrontendNotifierCreator, Func <IFrontendQueriesFactory, IBackendQueriesFactory, IErrorsInbox, IVisibilityPersistor, IBackendNotifier, T> resultor, IIdentityProvider identityProvider, BootstrapSettings settings) { var ebl = new InMemoryErrorsBacklog(); var fei = new QueuedErrorsInbox(ebl); var bei = new QueuedErrorsInbox(); //for backend only var ds = settings.VisibilityStoreBuilder != null ? settings.VisibilityStoreBuilder() : new InMemoryVisibilityStore(); var dh = new VisibilityHolder(ds); var fqf = new FrontendQueriesFactory(fei, bei, ebl, ebl, dh, dh, frontendNotifier, () => new FrontendErrorsQuery(), () => new RecapsQuery()); var ben = settings.Side == Side.Frontend && !string.IsNullOrWhiteSpace(settings.TargetBackendEndpoint) ? frontendBackendNotifierCreator(settings.TargetBackendEndpoint, bei, dh) : settings.Side == Side.Backend ? backendFrontendNotifierCreator() : NullBackendNotifier.Instance; var bqf = new BackendQueriesFactory(fei, ebl, ebl, dh, dh, ben, () => new BackendErrorsQuery(), () => new VisibilityQuery(settings.Side == Side.Frontend)); //Infrastructure registry.Register(typeof(IErrorsBacklog), () => ebl); registry.Register(typeof(IErrorsInbox), () => fei); registry.Register(typeof(IVisibilityPublisher), () => dh); registry.Register(typeof(IVisibilityPersistor), () => dh); registry.Register(typeof(IVisibilityStore), () => ds); registry.Register(typeof(IFrontendQueriesFactory), () => fqf); registry.Register(typeof(IBackendQueriesFactory), () => bqf); return(resultor(fqf, bqf, fei, dh, ben)); }