Exemplo n.º 1
0
        private T ReadConfig <T>(IDbConfig dbConfig, string propertyName)
        {
            string prefixed = string.Concat(Name == "State" ? string.Empty : string.Concat(Name, "Db"), propertyName);

            try
            {
                return((T)dbConfig.GetType().GetProperty(prefixed, BindingFlags.Public | BindingFlags.Instance).GetValue(dbConfig));
            }
            catch (Exception e)
            {
                throw new InvalidDataException($"Unable to read {prefixed} property from DB config", e);
            }
        }