using System.Diagnostics; using System.Text.Json; namespace WatchIt.Database.Model.Seeding; public class DataReader { #region METHODS public static IEnumerable Read() => Read(typeof(T).Name); public static IEnumerable Read(string filename) { string jsonFile = $@"{AppContext.BaseDirectory}/Data/{filename}.json"; string dataString = File.ReadAllText(jsonFile); IEnumerable? data = JsonSerializer.Deserialize>(dataString); if (data is null) { throw new JsonException(); } return data; } #endregion }