diff options
Diffstat (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons')
-rw-r--r-- | docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs | 2 | ||||
-rw-r--r-- | docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs | 13 |
2 files changed, 1 insertions, 14 deletions
diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs index eab8567..dc32387 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudService.cs @@ -108,7 +108,7 @@ public class CrudService<TEntity> : IDisposable where TEntity : class return result; } - public void UpdateByKey(object key, TEntity entity, UpdateBehavior behavior) + public void UpdateByKey(object key, TEntity entity, UpdateBehavior behavior = UpdateBehavior.None) { var affectedCount = _table.Update(_dbConnection, WhereClause.Create().Eq(_table.KeyColumn.ColumnName, key), ConvertEntityToUpdateClauses(entity, behavior)); diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs deleted file mode 100644 index 9eb6a08..0000000 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace CrupestApi.Commons; - - -public static class DatabaseHelper -{ - public static string GenerateUpdateColumnString(this IEnumerable<string> updateColumnList, IEnumerable<KeyValuePair<string, string>>? paramNameMap = null) - { - paramNameMap = paramNameMap ?? Enumerable.Empty<KeyValuePair<string, string>>(); - var paramNameDictionary = new Dictionary<string, string>(paramNameMap); - - return string.Join(", ", updateColumnList.Select(x => $"{x} = @{paramNameDictionary.GetValueOrDefault(x) ?? x}")); - } -}
\ No newline at end of file |