public void PutItem(IStorableItem i_Item) { if (i_Item is SimpleStorableItem) { PutItem(i_Item as SimpleStorableItem); } else { throw new ArgumentException("Only simple storable item can be saved to this storage"); } }
public void PutItem(IStorableItem i_Item) { if (i_Item is SimpleStorableItem) { PutItem(i_Item as SimpleStorableItem); } else { throw new ArgumentException("Only simple storable item can be saved to this storage"); } }
private static void ValidateEtagChangeMakesNotItemsEqual(IStorableItem <TId> before, IStorableItem <TId> after, string errorLocation) { var beforeEtag = before as IOptimisticConcurrencyControlByETag; var afterEtag = after as IOptimisticConcurrencyControlByETag; if (beforeEtag == null || afterEtag == null) { return; } FulcrumAssert.AreNotEqual(beforeEtag, afterEtag, errorLocation); beforeEtag.ETag = beforeEtag.ETag; FulcrumAssert.AreNotEqual(beforeEtag, afterEtag, errorLocation); }
private void ValidateEtag(IStorableItem <TId> current, IStorableItem <TId> item) { var currentWithEtag = current as IOptimisticConcurrencyControlByETag; var itemWithEtag = item as IOptimisticConcurrencyControlByETag; if (currentWithEtag == null || itemWithEtag == null) { return; } if (string.Equals(currentWithEtag.ETag, itemWithEtag.ETag, StringComparison.OrdinalIgnoreCase)) { return; } throw new FulcrumConflictException( $"The item of type {typeof(TStorableItem).Name} with id {item.Id} has been updated by someone else. Please get a fresh copy and try again."); }