Flattened and serialized snapshot object used as intermediate representation before saving snapshot with metadata inside SQL Server database.
        public DbCommand InsertSnapshot(SnapshotEntry entry)
        {
            var sqlCommand = new SqlCommand(_insertSql)
            {
                Parameters =
                {
                    new SqlParameter("@PersistenceId", SqlDbType.NVarChar, entry.PersistenceId.Length) { Value = entry.PersistenceId },
                    new SqlParameter("@SequenceNr", SqlDbType.BigInt) { Value = entry.SequenceNr },
                    new SqlParameter("@Timestamp", SqlDbType.DateTime2) { Value = entry.Timestamp },
                    new SqlParameter("@SnapshotType", SqlDbType.NVarChar, entry.SnapshotType.Length) { Value = entry.SnapshotType },
                    new SqlParameter("@Snapshot", SqlDbType.VarBinary, entry.Snapshot.Length) { Value = entry.Snapshot }
                }
            };

            return sqlCommand;
        }
Esempio n. 2
0
        public DbCommand InsertSnapshot(SnapshotEntry entry)
        {
            var sqlCommand = new SQLiteCommand(_insertSql)
            {
                Parameters =
                {
                    new SQLiteParameter("@PersistenceId", DbType.String, entry.PersistenceId.Length) { Value = entry.PersistenceId },
                    new SQLiteParameter("@SequenceNr", DbType.Int64) { Value = entry.SequenceNr },
                    new SQLiteParameter("@Timestamp", DbType.Int64) { Value = entry.Timestamp.Ticks },
                    new SQLiteParameter("@Manifest", DbType.String, entry.SnapshotType.Length) { Value = entry.SnapshotType },
                    new SQLiteParameter("@Snapshot", DbType.Binary, entry.Snapshot.Length) { Value = entry.Snapshot }
                }
            };

            return sqlCommand;
        }
        public DbCommand InsertSnapshot(SnapshotEntry entry)
        {
            var oracleCommand = new OracleCommand(_insertSql)
            {
                Parameters =
                {
                    new OracleParameter(":PersistenceId", OracleDbType.NVarchar2, entry.PersistenceId.Length) { Value = entry.PersistenceId },
                    new OracleParameter(":SequenceNr", OracleDbType.Decimal) { Value = entry.SequenceNr },
                    new OracleParameter(":Timestamp", OracleDbType.TimeStampTZ) { Value = entry.Timestamp },
                    new OracleParameter(":Manifest", OracleDbType.NVarchar2, entry.SnapshotType.Length) { Value = entry.SnapshotType },
                    new OracleParameter(":Snapshot", OracleDbType.LongRaw, entry.Snapshot.Length) { Value = entry.Snapshot }
                }
            };

            return oracleCommand;
        }
        public DbCommand InsertSnapshot(SnapshotEntry entry)
        {
            var sqlCommand = new NpgsqlCommand(_insertSql)
            {
                Parameters =
                {
                    new NpgsqlParameter(":persistence_id", NpgsqlDbType.Varchar, entry.PersistenceId.Length) { Value = entry.PersistenceId },
                    new NpgsqlParameter(":sequence_nr", NpgsqlDbType.Bigint) { Value = entry.SequenceNr },
                    new NpgsqlParameter(":created_at", NpgsqlDbType.Timestamp) { Value = GetMaxPrecisionTicks(entry.Timestamp) },
                    new NpgsqlParameter(":created_at_ticks", NpgsqlDbType.Smallint) { Value = GetExtraTicks(entry.Timestamp) },
                    new NpgsqlParameter(":manifest", NpgsqlDbType.Varchar, entry.SnapshotType.Length) { Value = entry.SnapshotType },
                    new NpgsqlParameter(":snapshot", NpgsqlDbType.Bytea, entry.Snapshot.Length) { Value = entry.Snapshot }
                }
            };

            return sqlCommand;
        }