/// <inheritdoc /> public virtual bool TryGetSettings <T>(string prefix, out T settings) where T : ISettings { var dictionary = new ConfigurationProviderDictionaryAdapter <T>(_configurationProvider, prefix); if (dictionary.Count == 0) { settings = default(T); return(false); } settings = _objectMapper.MapObject <T>(prefix, dictionary); return(true); }
/// <summary> /// Creates new object of type T from mapper object. /// </summary> /// <typeparam name="T">Type of target</typeparam> /// <param name="mapper">The mapper.</param> /// <returns>New object with properties mapped from mapper.</returns> public static T CreateMappedObject <T>(this IObjectMapper <T> mapper) where T : new() { if (mapper == null) { return(default(T)); } T newObject = new T(); mapper.MapObject(newObject); return(newObject); }