using System.Data.SqlClient;
using System.Collections.Generic;
public int OrderDetailID { get; set; }
public int OrderID { get; set; }
public int ProductID { get; set; }
public int Quantity { get; set; }
public IEnumerable<OrderDetail> Orders { get; set; }
public static void Main()
string sql = "SELECT OrderID, Quantity FROM OrderDetails";
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools()))
var orderDetail = connection.Query<OrderDetail>(sql);
var str = JsonConvert.SerializeObject(new Result { Orders = orderDetail },Formatting.Indented);