コード例 #1
0
ファイル: RelationEnumerator.cs プロジェクト: wikancz/BTDB
        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));
        }
コード例 #2
0
ファイル: RelationEnumerator.cs プロジェクト: srsman/BTDB
        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));
        }
コード例 #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));
        }
コード例 #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));
        }
コード例 #5
0
ファイル: RelationEnumerator.cs プロジェクト: wikancz/BTDB
 protected virtual T CreateInstance(ByteBuffer keyBytes, ByteBuffer valueBytes)
 {
     return((T)RelationInfo.CreateInstance(Transaction, keyBytes, valueBytes, false));
 }