public async Task FetchSingleByFilterAsync() { int id = 2; var filter = ConnectorOrders.CreateQuery(); filter.Add(x => x.ID, id); var order = await ConnectorOrders.FetchSingleAsync(filter); Console.WriteLine($"{order.ID} - {order.Created} - {order.CustomerID}"); Assert.AreEqual(id, order?.ID); }
public async Task FetchSingleBySqlAndFilterAsync() { int id = 3; string sql = $"SELECT * FROM cat_Orders WHERE Order_Key = @orderID"; //this is BAD PRACTICE! always use parameters var filter = ConnectorOrders.CreateQuery(); filter.AddParameter("@orderID", id); var order = await ConnectorOrders.FetchSingleAsync(sql, filter); Console.WriteLine($"{order.ID} - {order.Created} - {order.CustomerID}"); Assert.IsTrue(order?.ID == id); }