Refactor ApplicationDbContext to use a configuration-driven approach for mapping view and column names, enabling dynamic mapping through appsettings.json. Add TableConfigurations classes, update DI registration, and include the necessary options package for configuration binding. This improves maintainability and flexibility for schema changes.
20 lines
777 B
C#
20 lines
777 B
C#
namespace DbFirst.Infrastructure
|
|
{
|
|
public class TableConfigurations
|
|
{
|
|
public VwmyCatalogConfiguration VwmyCatalog { get; set; } = new();
|
|
}
|
|
|
|
public class VwmyCatalogConfiguration
|
|
{
|
|
public string ViewName { get; set; } = "VWMY_CATALOG";
|
|
public string GuidColumnName { get; set; } = "GUID";
|
|
public string CatTitleColumnName { get; set; } = "CAT_TITLE";
|
|
public string CatStringColumnName { get; set; } = "CAT_STRING";
|
|
public string AddedWhoColumnName { get; set; } = "ADDED_WHO";
|
|
public string AddedWhenColumnName { get; set; } = "ADDED_WHEN";
|
|
public string ChangedWhoColumnName { get; set; } = "CHANGED_WHO";
|
|
public string ChangedWhenColumnName { get; set; } = "CHANGED_WHEN";
|
|
}
|
|
}
|