public override void Delete(T entity) { if (entity is ISoftDelete) { ((ISoftDelete)entity).IsDeleted = true; Save(entity); } else { _transaction = _transaction.Delete(entity); this.Context.Execute(_transaction.DynamoCommand); } }
public override T Save(T entity) { entity.ExecuteBeforeSave(); if (entity.GetId() == default(Guid)) { entity.SetId(Guid.NewGuid()); _transaction = _transaction.Insert(entity); this.Context.Execute(_transaction.DynamoCommand); } else { _transaction = _transaction.Update(entity); this.Context.Execute(_transaction.DynamoCommand); } entity.ExecuteAfterSave(); return(entity); }