SqlSugar源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.7 KiB

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;
3 years ago
db.CodeFirst.InitTables<Unitasfa1sadfa>();
var list = db.Queryable<Unitasfa1sadfa>()
2 years ago
.Select(x => new
{
x = Convert.ToBoolean(x.ItemId),
x1 = SqlFunc.ToBool(x.ItemId)
})
.ToList();
db.CodeFirst.InitTables<UnitADSFA>();
2 years ago
var list2 = db.Queryable<UnitADSFA>().GroupBy(it => new
{
it.A,
2 years ago
x = it.A.ToString()
}).ToList();
2 years ago
var e = E.E1;
var query = db.Queryable<T>().Where(p => (p.E | e) == e );
var sql1 = query.ToSql().Key;
if (!sql1.Contains("="))
{
throw new Exception("unit error");
}
}
2 years ago
public class Unitasfa1sadfa
{
[SugarColumn(IsPrimaryKey = true)]
public Guid Id { get; set; }
[SugarColumn(IsNullable = true)]
public bool ItemId { get; set; }
2 years ago
}
2 years ago
public class UnitADSFA
{
public bool A { get; set; }
}
2 years ago
[Flags]
public enum E
{
E1 = 0x1,
E2 = 0x2,
E3 = 0x4,
}
public class T
{
public E E { get; set; }
}
}
2 years ago
}