public void Init(string connectionString, DatabaseProvider databaseType)
        {
            DatabaseProvider = databaseType;

            conn = DatabaseProvider.GetAndConfigureConnection(connectionString, (dbConnection, dbtype) =>
            {
                switch (dbtype)
                {
                case DatabaseProvider.MySqlData:
                    MySqlInsightDbProvider.RegisterProvider();
                    break;

                case DatabaseProvider.Npgsql:
                    PostgreSQLInsightDbProvider.RegisterProvider();
                    break;

                case DatabaseProvider.SystemData:
                case DatabaseProvider.MicrosoftData:
                    SqlInsightDbProvider.RegisterProvider();
                    break;

                case DatabaseProvider.MySqlConnector:
                    MySqlConnectorInsightDbProvider.RegisterProvider();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                return(dbConnection);
            });
        }
        public void DbSetup()
        {
            connection = new NpgsqlConnection(connectionString);
            PostgreSQLInsightDbProvider.RegisterProvider();
            connection.Open();

            var cmd = connection.CreateCommand();

            cmd.CommandText = $@"
                DROP TABLE IF EXISTS PostJson;

                CREATE TABLE IF NOT EXISTS PostJson
                (
                    Id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
                    Child JSON NOT NULL,
                    CreationDate DATE NOT NULL,
                    LastChangeDate DATE NOT NULL
                );

                DO $$
                DECLARE iter integer;
                        PostId integer;
                        ChildField json;
                BEGIN
                    iter := 0;
                    ChildField := '{Text}';
                WHILE iter< {iterations}
                LOOP

                    INSERT INTO PostJson(Child, CreationDate, LastChangeDate)
                    SELECT ChildField, NOW(), NOW();

                    iter:= iter + 1;
                END LOOP;
                END $$;
				"                ;

            cmd.Connection = connection;
            cmd.ExecuteNonQuery();
        }