Example #1
0
        protected override T CreateInstance(ByteBuffer keyBytes, ByteBuffer valueBytes)
        {
            var keyWriter = new ByteBufferWriter();

            keyWriter.WriteBlock(KeyBytes.Buffer, KeyBytes.Offset + _skipBytes, KeyBytes.Length - _skipBytes);
            keyWriter.WriteBlock(keyBytes);

            return((T)RelationInfo.CreateInstance(Transaction, keyWriter.Data, valueBytes, false));
        }
Example #2
0
        protected override T CreateInstance(ByteBuffer keyBytes, ByteBuffer valueBytes)
        {
            var keyData = new byte[KeyBytes.Length - _skipBytes + keyBytes.Length];

            Array.Copy(KeyBytes.Buffer, KeyBytes.Offset + _skipBytes, keyData, 0, KeyBytes.Length - _skipBytes);
            Array.Copy(keyBytes.Buffer, keyBytes.Offset, keyData, KeyBytes.Length - _skipBytes, keyBytes.Length);

            return((T)RelationInfo.CreateInstance(Transaction, ByteBuffer.NewAsync(keyData), valueBytes, false));
        }
Example #3
0
        public T FindByIdOrDefault(ByteBuffer keyBytes, bool throwWhenNotFound)
        {
            StartWorkingWithPK();
            if (_transaction.KeyValueDBTransaction.Find(keyBytes) != FindResult.Exact)
            {
                if (throwWhenNotFound)
                {
                    throw new BTDBException("Not found.");
                }
                return(default(T));
            }
            var valueBytes = _transaction.KeyValueDBTransaction.GetValue();

            return((T)_relationInfo.CreateInstance(_transaction, keyBytes, valueBytes));
        }
Example #4
0
        public T FindByIdOrDefault(ByteBuffer keyBytes, bool throwWhenNotFound)
        {
            ResetKeyPrefix();
            if (_kvtr.Find(keyBytes) != FindResult.Exact)
            {
                if (throwWhenNotFound)
                {
                    throw new BTDBException("Not found.");
                }
                return(default(T));
            }
            var valueBytes = _kvtr.GetValue();

            return((T)_relationInfo.CreateInstance(_transaction, keyBytes, valueBytes));
        }
Example #5
0
 protected virtual T CreateInstance(ByteBuffer keyBytes, ByteBuffer valueBytes)
 {
     return((T)RelationInfo.CreateInstance(Transaction, keyBytes, valueBytes, false));
 }