SqlSugar/Src/Asp.Net/SqlServerTest/UnitTest/UCustom010.cs

44 lines
1.1 KiB
C#
Raw Normal View History

2022-03-16 21:38:14 +08:00
using OrmTest.UnitTest.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class UCustom010
{
public static void Init()
{
var db = NewUnitTest.Db;
2022-03-16 21:58:03 +08:00
db.CodeFirst.InitTables<Unitasfa1sadfa>();
2022-03-16 21:38:14 +08:00
var list = db.Queryable<Unitasfa1sadfa>()
.Select(x => new { x = Convert.ToBoolean(x.ItemId),
x1 = SqlFunc.ToBool(x.ItemId)
})
.ToList();
2022-03-27 15:48:01 +08:00
db.CodeFirst.InitTables<UnitADSFA>();
var list2=db.Queryable<UnitADSFA>().GroupBy(it => new
{
it.A,
x=it.A.ToString()
}).ToList();
2022-03-16 21:38:14 +08:00
}
public class Unitasfa1sadfa
{
[SugarColumn(IsPrimaryKey = true)]
public Guid Id { get; set; }
[SugarColumn(IsNullable = true)]
public bool ItemId { get; set; }
}
2022-03-27 15:48:01 +08:00
public class UnitADSFA
{
public bool A { get; set; }
}
2022-03-16 21:38:14 +08:00
}
}