public TEntity Update <TEntity>(TEntity entity, int?version = null) where TEntity : class { var sql = dapperSqlGenerator?.Update(entity); if (!sql.IsNullOrEmpty()) { dbConnection.Execute(sql, entity); } else { dbConnection.Update(entity); } return(entity); }
public async Task <TEntity> Update(TEntity entity, int?expectedVersion, CancellationToken cancellationToken = default) { if (expectedVersion.HasValue) { throw new NotImplementedException(); } if (entity == null) { throw new ArgumentNullException(nameof(entity)); } var sql = dapperSqlGenerator?.Update(entity); if (!sql.IsNullOrEmpty()) { await dbConnection.ExecuteAsync(sql, entity); } else { await dbConnection.UpdateAsync(entity); } aggregateEventsPublisher.TryEnqueueEventsFrom(entity, out _); return(entity); }
public TEntity Update(TEntity entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } var sql = dapperSqlGenerator?.Update(entity); if (!sql.IsNullOrEmpty()) { dbConnection.Execute(sql, entity); } else { dbConnection.Update(entity); } return(entity); }