public static string GetValueByKey(string tableName, string columnName, object key, bool extension = false)
        {
            string value    = string.Empty;
            var    relation = TableKeys.GetColumnRelation(tableName, columnName, key);

            if (string.IsNullOrEmpty(relation.columnName) == false)
            {
                var cacheDict = GetValuesCache();
                var cacheKey  = CreateCacheKey(tableName, columnName, key, true, extension);
                if (cacheDict.ContainsKey(cacheKey))
                {
                    value = cacheDict[cacheKey];
                }
                else
                {
                    var    table        = TableManager.GetTable(relation.tableName);
                    string valueColName = GetValueColumnName(table, relation.columnName);
                    try {
                        if (extension)
                        {
                            value = SelectValueByKey(table, relation.columnName, key, valueColName);
                        }
                        else
                        {
                            value = TableManager.SelectScalarFromTable(table, relation.columnName, key, valueColName).ToString();
                        }
                        cacheDict.Add(cacheKey, value.ToString());
                    } catch {
                        //TODO вывод в лог
                    }
                }
            }
            return(value);
        }
        private static object SelectKeyByValue(DataTable relationTable, string idColName, object value, string valueColumnName)
        {
            object result      = -1;
            string stringValue = value.ToString();

            if ((int)result < 1)
            {
                result = (int)TableManager.SelectScalarFromTable(relationTable, valueColumnName, value, idColName);
            }
            return(result);
        }