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

37 lines
930 B
C#
Raw Normal View History

2022-04-12 16:27:23 +08:00
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class UCustom013
{
public static void Init()
{
var db = new SqlSugarScope(new SqlSugar.ConnectionConfig()
{
ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer,
IsAutoCloseConnection = true
});
db.CodeFirst.InitTables<UnitBoola1>();
2022-04-13 14:10:38 +08:00
db.Insertable(new UnitBoola1() { a = true }).ExecuteCommand();
2022-04-12 16:27:23 +08:00
db.Queryable<Order>()
.Select(x => new
{
2022-04-13 14:10:38 +08:00
x1 =(bool?) SqlFunc.Subqueryable<UnitBoola1>().Select(it => it.a)
2022-04-12 16:27:23 +08:00
}).ToList();
}
public class UnitBoola1
{
public bool a { get; set; }
}
}
}