C# 打印MYSQL查出来的数据(ORM框架使用SqlSugar)
using Newtonsoft.Json;
class Order
{
static void Main(string[] args)
{
var list = Db.Queryable()
.Where(it =>it.PayStatus==1)
.ToList();
Console.WriteLine(list);
Console.WriteLine(list[0].Price);
Console.WriteLine(JsonConvert.SerializeObject(list));
}
}
原类型输出:
Api.Core.Entity.OrderGoodsEntity
打印属性:
69800.00
转JSON后输出:
[{"OrderId":"1","PlatformOrderId":2,"PlatformProductId":"61","SellerProductId":"12","SellerSkuId":"79","ProductId":1,"SkuId":1,"Qty":4,"CancelQty":0,"Price":69800.00,"OccupyStock":0,"CreatedPurchase":0,"Id":"1"}]
list是一个类型直接打印看不到任何数据,
使用item.xxx可以打印他的属性,
转JSON后可以输出整个变量的所有数据