Revenj.DatabasePersistence.Postgres.Setup.ConfigurePostgres C# (CSharp) Method

ConfigurePostgres() public static method

public static ConfigurePostgres ( this builder, string connectionString ) : void
builder this
connectionString string
return void
        public static void ConfigurePostgres(this IObjectFactoryBuilder builder, string connectionString)
        {
            if (string.IsNullOrEmpty(connectionString))
                throw new ArgumentNullException("connectionString", "Connection string not provided");
            var ci = new Revenj.DatabasePersistence.Postgres.ConnectionInfo(connectionString);
            builder.RegisterSingleton(ci);
            builder.RegisterType<PostgresConnectionPool, IConnectionPool>(InstanceScope.Singleton);
            builder.RegisterType<PostgresQueryManager, IDatabaseQueryManager>(InstanceScope.Context);
            builder.RegisterType<PostgresDatabaseQuery, IPostgresDatabaseQuery>();
            builder.RegisterFunc(c => c.Resolve<IDatabaseQueryManager>().CreateQuery(), InstanceScope.Context);
            builder.RegisterType<PostgresDatabaseNotification, IDataChangeNotification, IEagerNotification>(InstanceScope.Singleton);
            builder.RegisterType<PostgresObjectFactory, IPostgresConverterRepository, IPostgresConverterFactory>(InstanceScope.Singleton);
            builder.RegisterType<QueryExecutor>();
            builder.RegisterSingleton<IPostgresVersionInfo>(new PostgresVersionInfo(ci));
            builder.RegisterFunc(c => BulkReaderHelper.BulkRead(c, ChunkedMemoryStream.Create()), InstanceScope.Context);
        }