public override IReadOnlyCollection <Row> Initialize()
 {
     Db.Config.DatabaseConnectionString.WithReader(Query, reader =>
     {
         Schema = new RowSchema(reader, PrimaryKeyColumns);
         _data  = new ReducableDictionary <object[], Row>(Schema.RowKeyEqualityComparer);
         while (reader.Read())
         {
             var row = Schema.ReadRow(reader);
             _data.Add(row.Key, row);
         }
     });
     return(_data.Values.ToArray());
 }
        public override IReadOnlyCollection <Row> Initialize()
        {
            var connectionString = Db.Config.DatabaseConnectionString;

            Schema = new RowSchema(connectionString, View.ViewName, PrimaryKeyColumns);

            CreateCacheTable(connectionString, View.ViewName, _cacheTableName, PrimaryKeyColumns);
            //Db.Config.DatabaseConnectionString.CreateMemoryViewCache(_view.ViewName,_cacheTableName,PrimaryKeyColumns);
            DisposeHelper.Attach(() => connectionString.WithConnection(con => con.ExecuteNonQuery($"DROP TABLE {_cacheTableName}")));

            _mergeSelectViewChanges = new MergeSelectViewChanges(_cacheTableName, View.ViewName, Schema.ColumnNames.Values.ToArray(), PrimaryKeyColumns, PrimaryKeyColumns);

            List <Row> rows = new List <Row>();

            connectionString.WithReader($"SELECT * FROM {_cacheTableName}", r =>
            {
                while (r.Read())
                {
                    rows.Add(Schema.ReadRow(r));
                }
            });
            return(rows);
        }