protected void Bootstrap(IComponentRegistry registry)
        {
            registry.RegisterInstance <ITransactionScopeFactory>(new DefaultTransactionScopeFactory(false, IsolationLevel.Unspecified, TimeSpan.Zero));

            registry.AttemptRegisterInstance(ConnectionConfigurationProvider);

            registry.RegisterInstance <IProjectionConfiguration>(new ProjectionConfiguration
            {
                EventProjectionConnectionString = ConnectionConfigurationProvider.Get(EventStoreProjectionConnectionStringName).ConnectionString,
                EventProjectionProviderName     = ConnectionConfigurationProvider.Get(EventStoreProjectionConnectionStringName).ProviderName,
                EventStoreConnectionString      = ConnectionConfigurationProvider.Get(EventStoreConnectionStringName).ConnectionString,
                EventStoreProviderName          = ConnectionConfigurationProvider.Get(EventStoreConnectionStringName).ProviderName
            });
        }
        /// <summary>
        ///     Registers a singleton instance for the given dependency type.
        /// </summary>
        /// <typeparam name="TDependency">The type of the dependency being registered.</typeparam>
        /// <param name="registry">The `IComponentRegistry` instance to register the mapping against.</param>
        /// <param name="instance">The singleton instance to be registered.</param>
        public static IComponentRegistry RegisterInstance <TDependency>(this IComponentRegistry registry,
                                                                        TDependency instance)
        {
            Guard.AgainstNull(registry, nameof(registry));

            registry.RegisterInstance(typeof(TDependency), instance);

            return(registry);
        }
示例#3
0
        public void Register(IComponentRegistry registry)
        {
            Guard.AgainstNull(registry, nameof(registry));

            if (!registry.IsRegistered <IOpswatConfiguration>())
            {
                registry.RegisterInstance(OpswatSection.Configuration());
            }

            registry.AttemptRegister <IOpswatApi, OpswatApi>();
            registry.AttemptRegister <IMalwareService, OpswatMalwareService>();
        }
        public static void RegisterIdempotence(this IComponentRegistry registry)
        {
            Guard.AgainstNull(registry, "registry");

            registry.AttemptRegister <IScriptProviderConfiguration, ScriptProviderConfiguration>();
            registry.AttemptRegister <IScriptProvider, ScriptProvider>();

            if (!registry.IsRegistered <IIdempotenceConfiguration>())
            {
                registry.RegisterInstance <IIdempotenceConfiguration>(IdempotenceSection.Configuration());
            }

            registry.AttemptRegister <IIdempotenceService, IdempotenceService>();
        }
示例#5
0
        protected void Boostrap(IComponentRegistry registry)
        {
            registry.RegisterInstance <ITransactionScopeFactory>(new DefaultTransactionScopeFactory(false, IsolationLevel.Unspecified, TimeSpan.Zero));

#if (NETCOREAPP2_1 || NETSTANDARD2_0)
            DbProviderFactories.RegisterFactory("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance);

            var connectionConfigurationProvider = new Mock <IConnectionConfigurationProvider>();

            connectionConfigurationProvider.Setup(m => m.Get(It.IsAny <string>())).Returns(
                (string name) =>
                name.Equals("EventStoreProjection")
                        ? new ConnectionConfiguration(
                    "EventStoreProjection",
                    "System.Data.SqlClient",
                    "Data Source=.\\sqlexpress;Initial Catalog=ShuttleProjection;Integrated Security=SSPI;")
                        : new ConnectionConfiguration(
                    name,
                    "System.Data.SqlClient",
                    "Data Source=.\\sqlexpress;Initial Catalog=Shuttle;Integrated Security=SSPI;"));

            registry.AttemptRegisterInstance(connectionConfigurationProvider.Object);

            registry.RegisterInstance <IProjectionConfiguration>(new ProjectionConfiguration
            {
                EventProjectionConnectionString =
                    connectionConfigurationProvider.Object.Get("EventStoreProjection").ConnectionString,
                EventProjectionProviderName =
                    connectionConfigurationProvider.Object.Get("EventStoreProjection").ProviderName,
                EventStoreConnectionString = connectionConfigurationProvider.Object.Get("Shuttle").ConnectionString,
                EventStoreProviderName     = connectionConfigurationProvider.Object.Get("Shuttle").ProviderName
            });
#else
            registry.AttemptRegister <IConnectionConfigurationProvider, ConnectionConfigurationProvider>();
#endif
        }
        public void Register(IComponentRegistry registry)
        {
            Guard.AgainstNull(registry, nameof(registry));

#if (NETCOREAPP2_1 || NETSTANDARD2_0)
            var connectionConfigurationProvider = new Mock <IConnectionConfigurationProvider>();

            connectionConfigurationProvider.Setup(m => m.Get(It.IsAny <string>())).Returns((string name) =>
                                                                                           new ConnectionConfiguration(
                                                                                               name,
                                                                                               "System.Data.SqlClient",
                                                                                               "Data Source=.\\sqlexpress;Initial Catalog=shuttle;Integrated Security=SSPI;"));

            registry.RegisterInstance(connectionConfigurationProvider.Object);
#else
            registry.Register <IConnectionConfigurationProvider, ConnectionConfigurationProvider>();
#endif
        }