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.
This commit is contained in:
2026-03-26 10:34:24 +01:00
parent 06e92b588f
commit e96773f3c4
4 changed files with 1 additions and 53 deletions

View File

@@ -1,8 +0,0 @@
namespace ReC.Application.Common.Exceptions;
public class DbModelConfigurationException : Exception
{
public DbModelConfigurationException() { }
public DbModelConfigurationException(string message) : base(message) { }
}

View File

@@ -1,20 +0,0 @@
using ReC.Application.Common.Exceptions;
namespace ReC.Application.Common.Options.DbModel;
public class DbModelOptions
{
public Dictionary<string, EntityOptions> 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.");
}
}
}

View File

@@ -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<string, string> 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}'.");
}
}
}

View File

@@ -25,6 +25,7 @@
<ItemGroup>
<Folder Include="Common\Behaviors\Action\" />
<Folder Include="Common\Options\DbModel\" />
</ItemGroup>
</Project>