public override void Delete(TEntity entity) { ActionFilterExecuter.ExecuteDeletionAuditFilter <TEntity, string>(entity); EntityChangeEventHelper.TriggerEntityDeletingEvent(entity); if (entity is ISoftDelete) { Session.Bucket.Upsert(new Document <TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }).EnsureSuccess(); } else { Session.Bucket.Remove(new Document <TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }).EnsureSuccess(); } EntityChangeEventHelper.TriggerEntityDeletedEventOnUowCompleted(entity); }
public override TEntity Update(TEntity entity) { ActionFilterExecuter.ExecuteModificationAuditFilter <TEntity, string>(entity); IDocumentResult <TEntity> result = Session.Bucket.Upsert(new Document <TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }); result.EnsureSuccess(); return(result.Content); }
public override TEntity Insert(TEntity entity) { entity.Id = GuidGenerator.Create().ToString("N"); ActionFilterExecuter.ExecuteCreationAuditFilter <TEntity, string>(entity); IDocumentResult <TEntity> result = Session.Bucket.Insert(new Document <TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }); result.EnsureSuccess(); return(result.Content); }
public override TEntity Update(TEntity entity) { ActionFilterExecuter.ExecuteModificationAuditFilter<TEntity, string>(entity); EntityChangeEventHelper.PublishEntityUpdatingEvent(entity); IDocumentResult<TEntity> result = Session.Bucket.Upsert(new Document<TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }); result.EnsureSuccess(); EntityChangeEventHelper.PublishEntityUpdatedEventOnUowCompleted(entity); return result.Content; }
public override TEntity Insert(TEntity entity) { entity.Id = GuidGenerator.Create().ToString("N"); ActionFilterExecuter.ExecuteCreationAuditFilter<TEntity, string>(entity); EntityChangeEventHelper.PublishEntityCreatingEvent(entity); IDocumentResult<TEntity> result = Session.Bucket.Insert(new Document<TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }); result.EnsureSuccess(); EntityChangeEventHelper.PublishEntityCreatedEventOnUowCompleted(entity); return result.Content; }
public override void Delete(TEntity entity) { ActionFilterExecuter.ExecuteDeletionAuditFilter <TEntity, string>(entity); if (entity is ISoftDelete) { Session.Bucket.Upsert(new Document <TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }).EnsureSuccess(); } else { Session.Bucket.Remove(new Document <TEntity> { Content = entity, Id = $"{typeof(TEntity).Name}:{entity.Id}" }).EnsureSuccess(); } }