/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <IEventStore>().To <NullEventStore>().Singleton(); builder.Bind <IEventSourceVersions>().To <NullEventSourceVersions>().Singleton(); builder.Bind <IEventEnvelopes>().To <EventEnvelopes>(); builder.Bind <IEventSequenceNumbers>().To <NullEventSequenceNumbers>(); builder.Bind <IEventProcessors>().To <EventProcessors>(); builder.Bind <IEventProcessorLog>().To <NullEventProcessorLog>(); builder.Bind <IEventProcessorStates>().To <NullEventProcessorStates>(); //builder.Bind<ICanSendCommittedEventStream>().To<NullCommittedEventStreamSender>().Singleton(); var bridge = new CommittedEventStreamBridge(); builder.Bind <ICommittedEventStreamBridge>().To(bridge); builder.Bind <ICanSendCommittedEventStream>().To <CommittedEventStreamSender>().Singleton(); var receiver = new CommittedEventStreamReceiver(bridge, new NullLogger()); builder.Bind <ICanReceiveCommittedEventStream>().To(receiver); builder.Bind <ExecutionContextPopulator>().To((ExecutionContext, details) => { }); builder.Bind <ClaimsPrincipal>().To(() => new ClaimsPrincipal(new ClaimsIdentity())); builder.Bind <CultureInfo>().To(() => CultureInfo.InvariantCulture); builder.Bind <ICallContext>().To(new DefaultCallContext()); builder.Bind <ICanResolvePrincipal>().To(new DefaultPrincipalResolver()); var applicationConfigurationBuilder = new ApplicationConfigurationBuilder("Studio") .Application(applicationBuilder => applicationBuilder .PrefixLocationsWith(new BoundedContext("Sentry")) .WithStructureStartingWith <BoundedContext>(_ => _) //(new ApplicationStructureFragment(typeof(BoundedContext)), _ => { }) ) .StructureMappedTo(_ => _ .Domain("Domain.-^{Feature}.-^{SubFeature}*") .Domain("Domain.-^{Module}.-^{Feature}.-^{SubFeature}*") .Events("Events.-^{Feature}.-^{SubFeature}*") .Events("Events.-^{Module}.-^{Feature}.-^{SubFeature}*") .Read("Read.-^{Feature}.-^{SubFeature}*") .Read("Read.-^{Module}.-^{Feature}.-^{SubFeature}*") .Frontend("Web.-^{Feature}.-^{SubFeature}*") .Frontend("Web.-^{Module}.-^{Feature}.-^{SubFeature}*") ); (IApplication application, IApplicationStructureMap structureMap)applicationConfiguration = applicationConfigurationBuilder.Build(); builder.Bind <IApplication>().To(applicationConfiguration.application); builder.Bind <IApplicationStructureMap>().To(applicationConfiguration.structureMap); builder.Bind <Dolittle.ReadModels.MongoDB.Configuration>().To(new Dolittle.ReadModels.MongoDB.Configuration { Url = "mongodb://localhost:27017", UseSSL = false, DefaultDatabase = "Demo" }); builder.Bind(typeof(IReadModelRepositoryFor <>)).To(typeof(ReadModelRepositoryFor <>)); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { var mqttServer = new MqttFactory().CreateMqttServer(); mqttServer.StartAsync(new MqttServerOptions()).Wait(); builder.Bind <IMqttServer>().To(mqttServer); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <IEventStore>().To <NullEventStore>().Singleton(); builder.Bind <IEventSourceVersions>().To <NullEventSourceVersions>().Singleton(); builder.Bind <IEventEnvelopes>().To <EventEnvelopes>(); builder.Bind <IEventSequenceNumbers>().To <NullEventSequenceNumbers>(); builder.Bind <IEventProcessors>().To <EventProcessors>(); builder.Bind <IEventProcessorLog>().To <NullEventProcessorLog>(); builder.Bind <IEventProcessorStates>().To <NullEventProcessorStates>(); //builder.Bind<ICanSendCommittedEventStream>().To<NullCommittedEventStreamSender>().Singleton(); var bridge = new CommittedEventStreamBridge(); builder.Bind <ICommittedEventStreamBridge>().To(bridge); builder.Bind <ICanSendCommittedEventStream>().To <Infrastructure.Kafka.BoundedContexts.CommittedEventStreamSender>().Singleton(); var receiver = new CommittedEventStreamReceiver(bridge, new NullLogger()); builder.Bind <ICanReceiveCommittedEventStream>().To(receiver); builder.Bind <ExecutionContextPopulator>().To((ExecutionContext, details) => { }); builder.Bind <ClaimsPrincipal>().To(() => new ClaimsPrincipal(new ClaimsIdentity())); builder.Bind <CultureInfo>().To(() => CultureInfo.InvariantCulture); builder.Bind <ICallContext>().To(new DefaultCallContext()); builder.Bind <ICanResolvePrincipal>().To(new DefaultPrincipalResolver()); var boundedContext = new BoundedContext("visualization"); builder.Bind <BoundedContext>().To(boundedContext); var applicationConfigurationBuilder = new ApplicationConfigurationBuilder("OCFEV") .Application(applicationBuilder => applicationBuilder .PrefixLocationsWith(boundedContext) .WithStructureStartingWith <BoundedContext>(_ => _ .Required.WithChild <Feature>(f => f .WithChild <SubFeature>(c => c.Recursive) ) ) ) .StructureMappedTo(_ => _ .Domain("Infrastructure.Events.-^{Feature}.-^{SubFeature}*") .Domain("Domain.-^{Feature}.-^{SubFeature}*") .Domain("Domain.-^{Module}.-^{Feature}.-^{SubFeature}*") .Events("Events.-^{Feature}.-^{SubFeature}*") .Events("Events.-^{Module}.-^{Feature}.-^{SubFeature}*") .Events("ExternalEvents.-^{Feature}.-^{SubFeature}*") .Events("ExternalEvents.-^{Module}.-^{Feature}.-^{SubFeature}*") .Read("Read.-^{Feature}.-^{SubFeature}*") .Read("Read.-^{Module}.-^{Feature}.-^{SubFeature}*") .Frontend("Web.-^{Feature}.-^{SubFeature}*") .Frontend("Web.-^{Module}.-^{Feature}.-^{SubFeature}*") ); (IApplication application, IApplicationStructureMap structureMap)applicationConfiguration = applicationConfigurationBuilder.Build(); builder.Bind <IApplication>().To(applicationConfiguration.application); builder.Bind <IApplicationStructureMap>().To(applicationConfiguration.structureMap); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <IEventStore>().To <Dolittle.Runtime.Events.Store.MongoDB.EventStore>(); builder.Bind(typeof(IReadModelRepositoryFor <>)).To(typeof(ReadModelRepositoryFor <>)); builder.Bind <IEventProcessorOffsetRepository>().To <EventProcessorOffsetRepository>(); // builder.Bind<Dolittle.Runtime.Events.Relativity.IGeodesics>().To<Dolittle.Runtime.Events.Relativity.MongoDB.Geodesics>(); }
public void Provide(IBindingProviderBuilder builder) { builder.Bind <ICallContext>().To <DefaultCallContext>(); builder.Bind <ExecutionContextPopulator>().To((ExecutionContext, details) => { }); builder.Bind <ClaimsPrincipal>().To(() => new ClaimsPrincipal(new ClaimsIdentity())); builder.Bind <CultureInfo>().To(() => CultureInfo.InvariantCulture); builder.Bind <ICanResolvePrincipal>().To(new DefaultPrincipalResolver()); var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("Warehouse_EventStore"); builder.Bind <IMongoDatabase>().To(database); builder.Bind <IEventStore>().To <Dolittle.Runtime.Events.Store.MongoDB.EventStore>(); builder.Bind <IUncommittedEventStreamCoordinator>().To <UncommittedEventStreamCoordinator>(); builder.Bind <Dolittle.ReadModels.MongoDB.Configuration>().To(new Dolittle.ReadModels.MongoDB.Configuration { Url = "mongodb://localhost:27017", UseSSL = false, DefaultDatabase = "Warehouse_ReadModels" }); builder.Bind(typeof(IReadModelRepositoryFor <>)).To(typeof(ReadModelRepositoryFor <>)); }
public void Provide(IBindingProviderBuilder builder) { builder.Bind <IGitHubCredentials>().To(new GitHubCredentials()); builder.Bind <IGitHubClientFactory>().To <GitHubClientFactory>(); builder.Bind <IGitHubUserTokenStore>().To <GitHubUserTokenStore>(); }
public void Provide(IBindingProviderBuilder builder) { builder.Bind <ICanTriggerRemoteAuthentication>().To <RemoteAuthenticator>(); builder.Bind <ICanSignUserInToTenant>().To <LocalAuthenticator>(); builder.Bind <ICanGenerateTenantPrincipal>().To <TenantPrincipalGenerator>(); builder.Bind <ICanHandleDeviceAuthorization>().To <DeviceAuthorizer>(); builder.Bind <IAuthenticationFrontend>().To <AuthenticationFrontend>(); builder.Bind <ICustomFrontendServer>().To <CustomFrontendServer>(); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { var collectorRegistry = new CollectorRegistry(); var constructors = typeof(Prometheus.MetricFactory).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance); var constructor = constructors[0]; var prometheusFactory = constructor.Invoke(new object[] { collectorRegistry }) as Prometheus.MetricFactory; builder.Bind <Prometheus.MetricFactory>().To(prometheusFactory); builder.Bind <CollectorRegistry>().To(collectorRegistry); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { var buildTarget = Program.BuildTarget; if (buildTarget == null) { buildTarget = new BuildTarget(null, null, null, null); } builder.Bind <BuildTarget>().To(buildTarget); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <IEventStoreConnection>().To <EventStoreConnection>(); builder.Bind <IStreamProcessorStateRepository>().To <StreamProcessorStateRepository>(); builder.Bind <IStreamDefinitionRepository>().To <StreamDefinitionRepository>(); builder.Bind <IEventFetchers>().To <EventFetchers>(); builder.Bind <IWriteEventsToStreams>().To <EventsToStreamsWriter>(); builder.Bind <IWriteEventsToStreamCollection>().To <EventsToStreamsWriter>(); builder.Bind <IWriteEventHorizonEvents>().To <EventHorizonEventsWriter>(); builder.Bind <IWriteEventsToPublicStreams>().To <EventsToPublicStreamsWriter>(); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { if (!IoTEdgeHelpers.IsRunningInIotEdge()) { builder.Bind <ICommunicationClient>().To <NullCommunicationClient>(); } else { builder.Bind <ICommunicationClient>().To <CommunicationClient>(); } }
public void Provide(IBindingProviderBuilder builder) { builder.Bind <ClaimsPrincipal>().To(() => { if (CurrentClaimsPrincipal.Value == null) { return(new ClaimsPrincipal(new ClaimsIdentity())); } return(CurrentClaimsPrincipal.Value); }); builder.Bind <ICanResolvePrincipal>().To(new PrincipalResolver()); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <ICanProvideResourceConfigurationsByTenant>().To <ResourceConfigurationsByTenantProvider>(); var resourceConfiguration = new ResourceConfiguration(_typeFinder, _container, _logger); builder.Bind <IResourceConfiguration>().To(resourceConfiguration); var resourceTypeTypes = _typeFinder.FindMultiple <IAmAResourceType>(); var resourceTypeServices = resourceTypeTypes.Select(_ => _container.Get(_) as IAmAResourceType).SelectMany(_ => _.Services); resourceTypeServices.ForEach(_ => builder.Bind(_).To(() => resourceConfiguration.GetImplementationFor(_))); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind(typeof(IPolicyFor <>)).To((BindingContext context) => { var policies = _getContainer().Get <IPolicies>(); Expression <Func <IPolicyFor <object> > > getForExpression = () => policies.GetFor <object>(); var methodInfo = getForExpression.GetMethodInfo().GetGenericMethodDefinition(); var target = context.Service.GenericTypeArguments[0]; var genericMethodInfo = methodInfo.MakeGenericMethod(target); var result = genericMethodInfo.Invoke(policies, null); return(result); }); }
public void Provide(IBindingProviderBuilder builder) { var connectionString = Environment.GetEnvironmentVariable("EdgeHubConnectionString"); var mqttSetting = new MqttTransportSettings(TransportType.Mqtt_Tcp_Only); // During dev you might want to bypass the cert verification. It is highly recommended to verify certs systematically in production //mqttSetting.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; ITransportSettings[] settings = { mqttSetting }; var deviceClient = DeviceClient.CreateFromConnectionString(connectionString, settings); deviceClient.OpenAsync().Wait(); builder.Bind <DeviceClient>().To(deviceClient); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { var interfaceType = typeof(IRuleImplementationFor <>); var ruleImplementations = _typeFinder.FindMultiple(interfaceType); ruleImplementations.ForEach(_ => { var @interface = _.GetInterfaces().SingleOrDefault(t => $"{t.Namespace}.{t.Name}" == $"{interfaceType.Namespace}.{interfaceType.Name}"); var ruleType = @interface.GetGenericArguments()[0]; builder.Bind(ruleType).To(() => { var ruleImplementation = _getContainer().Get(_); var ruleProperty = _.GetProperty("Rule", BindingFlags.Public | BindingFlags.Instance); return(ruleProperty.GetValue(ruleImplementation)); }); }); }
public void Provide(IBindingProviderBuilder builder) { var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("Alerts_EventStore"); builder.Bind <IMongoDatabase>().To(database); builder.Bind <IEventStore>().To <Dolittle.Runtime.Events.Store.MongoDB.EventStore>(); builder.Bind <Dolittle.ReadModels.MongoDB.Configuration>().To(new Dolittle.ReadModels.MongoDB.Configuration { Url = "mongodb://localhost:27017", UseSSL = false, DefaultDatabase = "Alerts_ReadModels" }); builder.Bind(typeof(IReadModelRepositoryFor <>)).To(typeof(ReadModelRepositoryFor <>)); builder.Bind <IEventProcessorOffsetRepository>().To <EventProcessorOffsetRepository>(); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { var mongoConnectionString = Environment.GetEnvironmentVariable("MONGO"); var client = new MongoClient(mongoConnectionString); var database = client.GetDatabase("CI_EventStore"); var eventStoreConfig = new EventStoreConfig(database, Dolittle.Logging.Logger.Internal); builder.Bind <EventStoreConfig>().To(eventStoreConfig); builder.Bind <IEventStore>().To <Dolittle.Runtime.Events.Store.MongoDB.EventStore>(); builder.Bind <Dolittle.ReadModels.MongoDB.Configuration>().To(new Dolittle.ReadModels.MongoDB.Configuration { Url = mongoConnectionString, UseSSL = false, DefaultDatabase = "CI_Read" }); builder.Bind(typeof(IReadModelRepositoryFor <>)).To(typeof(ReadModelRepositoryFor <>)); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { var config = new KubernetesClientConfiguration(); if (Environment.GetEnvironmentVariable(_clusterApiEnvName) != null && File.Exists(_clusterTokenPath)) { // Use config for an in-cluster client config.Host = Environment.GetEnvironmentVariable(_clusterApiEnvName); config.AccessToken = File.ReadAllText(_clusterTokenPath); config.SkipTlsVerify = false; } else { // Allow connecting through a local tunnel during development config.Host = _localApi; config.SkipTlsVerify = true; } builder.Bind <IKubernetes>().To(() => new k8s.Kubernetes(config)); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { var localApi = "http://127.0.0.1:8001"; var kubernetesApi = Environment.GetEnvironmentVariable("KUBERNETES_API") ?? localApi; var kubernetesTokenPath = "/var/run/secrets/kubernetes.io/serviceaccount/token"; var config = new KubernetesClientConfiguration { Host = kubernetesApi, SkipTlsVerify = true }; if (kubernetesApi != localApi && File.Exists(kubernetesTokenPath)) { config.AccessToken = File.ReadAllText(kubernetesTokenPath); } var client = new Kubernetes(config); builder.Bind <Kubernetes>().To(client).Singleton(); }
public void Provide(IBindingProviderBuilder builder) { var mongoConnectionString = System.Environment.GetEnvironmentVariable("MONGO"); var client = new MongoClient(mongoConnectionString); var database = client.GetDatabase("OCFEV_EventStore"); builder.Bind <IMongoDatabase>().To(database); builder.Bind <IEventStore>().To <Dolittle.Runtime.Events.Store.MongoDB.EventStore>(); builder.Bind <IUncommittedEventStreamCoordinator>().To <UncommittedEventStreamCoordinator>(); builder.Bind <Dolittle.ReadModels.MongoDB.Configuration>().To(new Dolittle.ReadModels.MongoDB.Configuration { Url = mongoConnectionString, UseSSL = false, DefaultDatabase = "OCFEV_ReadModels" }); builder.Bind(typeof(IReadModelRepositoryFor <>)).To(typeof(ReadModelRepositoryFor <>)); builder.Bind <IEventProcessorOffsetRepository>().To <EventProcessorOffsetRepository>(); builder.Bind <ITenantOffsetRepository>().To <TenantOffsetRepository>(); builder.Bind <IGeodesics>().To <Geodesics>(); }
public void Provide(IBindingProviderBuilder builder) { builder.Bind <ISecurityBypassingRequestManager>().To <BypassControllersManager>(); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <Application>().To(() => Application); builder.Bind <BoundedContext>().To(() => BoundedContext); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <IMongoDatabase>().To <MongoDatabaseProxy>(); builder.Bind(typeof(IMongoCollection <>)).To(typeof(MongoCollectionProxy <>)); }
public void Provide(IBindingProviderBuilder builder) { builder.Bind <IIdenityProviderManager>().To <IdentityProviderManager>(); builder.Bind <IPostConfigureOptions <OpenIdConnectOptions> >().To <OpenIdConnectPostConfigureOptions>().Singleton(); }
public void Provide(IBindingProviderBuilder builder) { builder.Bind <IIdentityServerOptionsProvider>().To <IdentityServerOptionsProvider>(); builder.Bind <ITokenService>().To <TokenGenerator>(); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <IRegisterEventHandlers>().To <EventHandlerRegistry>(); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <ITenantOffsetRepository>().To <TenantOffsetRepository>(); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <ArtifactTypes>().To(new ArtifactTypes()); }
/// <inheritdoc/> public void Provide(IBindingProviderBuilder builder) { builder.Bind <Application>().To(() => _boundedContextConfiguration.Application); builder.Bind <Microservice>().To(() => _boundedContextConfiguration.BoundedContext); }