/// <inheritdoc/> public object Provide(Type type) { var json = _fileSystem.ReadAllText(_path); var configObject = _parsers.Parse(type, _path, json); return(configObject); }
/// <inheritdoc/> public object Provide(Type type) { var name = type.GetFriendlyConfigurationName().ToCamelCase(); var json = _twin.Properties.Desired[name].ToString(); var instance = _parsers.Parse(type, name, json); if (instance != null) { return(instance); } throw new UnableToProvideConfigurationObject <DesiredPropertiesConfigurationObjectProvider>(type); }
/// <inheritdoc/> public object Provide(Type type) { var filename = GetFilenameFor(type); var resourceName = _entryAssembly.GetManifestResourceNames().SingleOrDefault(_ => _.EndsWith(filename, StringComparison.InvariantCultureIgnoreCase)); if (resourceName != null) { using (var reader = new StreamReader(_entryAssembly.GetManifestResourceStream(resourceName))) { var content = reader.ReadToEnd(); return(_parsers.Parse(type, resourceName, content)); } } throw new UnableToProvideConfigurationObject <ManifestResourceStreamConfigurationObjectsProvider>(type); }
/// <inheritdoc/> public object Provide(Type type) { object instance = null; SearchPaths.ForEach(_ => { var filename = GetFilenameFor(type, _); if (_fileSystem.Exists(filename)) { var content = _fileSystem.ReadAllText(filename); instance = _parsers.Parse(type, filename, content); } }); if (instance != null) { return(instance); } throw new UnableToProvideConfigurationObject <FileConfigurationObjectsProvider>(type); }