Код: Выделить всё
Dictionary dic = new Dictionary
{
...
{ PlanVariablesDefinitions.Growth_Proposed_Savings_Rate, L.GrowthProposedSavingsRate.ToString("0.00") },
{ PlanVariablesDefinitions.Growth_Proposed_Income_Growth_Rate, L.GrowthProposedIncomeGrowthRate.ToString() },
{ PlanVariablesDefinitions.Growth_Proposed_Portfolio_Growth_Rate, L.GrowthProposedPortfolioGrowthRate.ToString() },
{ PlanVariablesDefinitions.Growth_Proposed_FMVRealEstate_Growth_Rate, L.GrowthProposedFMVRealEstateGrowthRate.ToString() },
...
}
Код: Выделить всё
public const string Growth_Proposed_Savings_Rate = "Growth_Proposed_Savings_Rate";
public const string Growth_Proposed_Income_Growth_Rate = "Growth_Proposed_Income_Growth_Rate";
public const string Growth_Proposed_Portfolio_Growth_Rate = "Growth_Proposed_Portfolio_Growth_Rate";
public const string Growth_Proposed_FMVRealEstate_Growth_Rate = "Growth_Proposed_FMVRealEstate_Growth_Rate";
Когда это изменение будет выполнено, разработчик не знает, что эта модификация приведет к сбою системы в какой-то момент, когда эта строка будет вставлена в базу данных.
Пока я помещаю этот код только для того, чтобы быстрый сбой и обнаружение таких случаев при первом запуске:
Код: Выделить всё
foreach (var item in dic)
if (item.Key.Length > 50)
throw new Exception($"{item.Key} is over 50 chars and will throw an exception on DB save.");
Подробнее здесь: https://stackoverflow.com/questions/791 ... -the-db-co
Мобильная версия