コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public ProductProvider(IOptionsSnapshot <CatalogOptions> options)
 {
     Options = options.Value;
 }