From e96773f3c40eac78495f591a029bb079d53e2fb4 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 26 Mar 2026 10:34:24 +0100 Subject: [PATCH] Remove DbModelConfigurationException and related logic Removed the DbModelConfigurationException class and all its usages from DbModelOptions and EntityOptions. Indexers in these classes no longer throw this exception when configuration is missing. Updated the project file to include the Common\Options\DbModel\ folder. --- .../DbModelConfigurationException.cs | 8 ------ .../Common/Options/DbModel/DbModelOptions.cs | 20 --------------- .../Common/Options/DbModel/EntityOptions.cs | 25 ------------------- src/ReC.Application/ReC.Application.csproj | 1 + 4 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 src/ReC.Application/Common/Exceptions/DbModelConfigurationException.cs delete mode 100644 src/ReC.Application/Common/Options/DbModel/DbModelOptions.cs delete mode 100644 src/ReC.Application/Common/Options/DbModel/EntityOptions.cs diff --git a/src/ReC.Application/Common/Exceptions/DbModelConfigurationException.cs b/src/ReC.Application/Common/Exceptions/DbModelConfigurationException.cs deleted file mode 100644 index cb678b3..0000000 --- a/src/ReC.Application/Common/Exceptions/DbModelConfigurationException.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ReC.Application.Common.Exceptions; - -public class DbModelConfigurationException : Exception -{ - public DbModelConfigurationException() { } - - public DbModelConfigurationException(string message) : base(message) { } -} diff --git a/src/ReC.Application/Common/Options/DbModel/DbModelOptions.cs b/src/ReC.Application/Common/Options/DbModel/DbModelOptions.cs deleted file mode 100644 index 47d8ea1..0000000 --- a/src/ReC.Application/Common/Options/DbModel/DbModelOptions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using ReC.Application.Common.Exceptions; - -namespace ReC.Application.Common.Options.DbModel; - -public class DbModelOptions -{ - public Dictionary Entities { get; set; } = []; - - public EntityOptions this[string entityName] - { - get - { - if (Entities.TryGetValue(entityName, out var entity)) - return entity; - - throw new DbModelConfigurationException( - $"Entity '{entityName}' is not configured in DbModel options."); - } - } -} diff --git a/src/ReC.Application/Common/Options/DbModel/EntityOptions.cs b/src/ReC.Application/Common/Options/DbModel/EntityOptions.cs deleted file mode 100644 index 8d79bc1..0000000 --- a/src/ReC.Application/Common/Options/DbModel/EntityOptions.cs +++ /dev/null @@ -1,25 +0,0 @@ -using ReC.Application.Common.Exceptions; - -namespace ReC.Application.Common.Options.DbModel; - -public class EntityOptions -{ - public string? Name { get; set; } - - public string Schema { get; set; } = "dbo"; - - public Dictionary ColumnMappings { get; set; } = []; - - public string this[string propertyName] - { - get - { - if (ColumnMappings.TryGetValue(propertyName, out var columnName)) - return columnName; - - var viewDisplay = Name ?? "unknown"; - throw new DbModelConfigurationException( - $"Column mapping for property '{propertyName}' is not configured for entity '{viewDisplay}'."); - } - } -} diff --git a/src/ReC.Application/ReC.Application.csproj b/src/ReC.Application/ReC.Application.csproj index fe5448d..236efdc 100644 --- a/src/ReC.Application/ReC.Application.csproj +++ b/src/ReC.Application/ReC.Application.csproj @@ -25,6 +25,7 @@ +