public CarFactory(IDbCars db) { _ = db ?? throw new ArgumentNullException(nameof(db)); // NOTE: sync-over-async, might deadlock, i.e we are blocking! Cars = db.GetCarsQueryAsync().Result.ToList(); }
public static async Task <CarFactory> CreateCarFactory(IDbCars db) { _ = db ?? throw new ArgumentNullException(nameof(db)); var cars = (await db.GetCarsQueryAsync()).ToList(); var carFactory = new CarFactory(cars); return(carFactory); }