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)); }
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)); }
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)); }
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)); }
protected virtual T CreateInstance(ByteBuffer keyBytes, ByteBuffer valueBytes) { return((T)RelationInfo.CreateInstance(Transaction, keyBytes, valueBytes, false)); }