public ProductProvider(string catalogPath) { if (catalogPath.IsEmpty()) { throw new ArgumentNullException(nameof(catalogPath)); } File = Device.IO.File(catalogPath).ExistsOrThrow(); var text = File.ReadAllText(); Options = JsonConvert.DeserializeObject <CatalogOptions>(text); if (Options.Products is null) { throw new Exception("Products is null in: " + File.Name); } }
public ProductProvider(IOptionsSnapshot <CatalogOptions> options) { Options = options.Value; }