public bool Insert(T obj) { Debug.Assert(typeof(T) == obj.GetType(), AssertNotDerivedTypesMsg); var keyBytes = KeyBytes(obj); var valueBytes = ValueBytes(obj); StartWorkingWithPK(); if (_transaction.KeyValueDBTransaction.Find(keyBytes) == FindResult.Exact) { return(false); } _transaction.KeyValueDBTransaction.CreateOrUpdateKeyValue(keyBytes, valueBytes); if (HasSecondaryIndexes) { AddIntoSecondaryIndexes(obj); } _modificationCounter.MarkModification(); return(true); }
public bool Insert(T obj) { Debug.Assert(typeof(T) == obj.GetType(), AssertNotDerivedTypesMsg); var keyBytes = KeyBytes(obj); var valueBytes = ValueBytes(obj); ResetKeyPrefix(); if (_kvtr.Find(keyBytes) == FindResult.Exact) { return(false); } _kvtr.CreateOrUpdateKeyValue(keyBytes, valueBytes); if (_hasSecondaryIndexes) { AddIntoSecondaryIndexes(obj); } _modificationCounter.MarkModification(); return(true); }