- 增加 fsql.Ado.QuerySingle(() => new {}) 扩展方法实现无表查询 SELECT now(), utc_timestamp()

This commit is contained in:
2881099
2022-10-10 19:20:35 +08:00
parent b5b820d272
commit 3e5e84f83c
3 changed files with 47 additions and 8 deletions

View File

@ -364,6 +364,8 @@ namespace base_entity
public string name { get; set; }
[Column(MapType = typeof(string))]
public string JoinTest01Enum { get; set; }
[Column(MapType = typeof(int))]
public JoinTest01Enum JoinTest01Enum2 { get; set; }
[JoinCondition("a.parentcode = b.code")]
public JoinTest01 Parent { get; set; }
@ -394,7 +396,7 @@ namespace base_entity
//.UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5")
//.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=2")
.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=2")
//.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true")
@ -427,6 +429,12 @@ namespace base_entity
BaseEntity.Initialization(fsql, () => _asyncUow.Value);
#endregion
var result1x = fsql.Ado.QuerySingle(() => new
{
DateTime.Now,
DateTime.UtcNow,
Math.PI
});
Dictionary<string, object> dic = new Dictionary<string, object>();
@ -506,13 +514,13 @@ namespace base_entity
.Replace("a.", e.Tables[a].Alias + ".")
.Replace("b.", parentTable.Alias + ".");
}
e.Result = result;
};
var joinsql1 = fsql.Select<JoinTest01>()
.Include(a => a.Parent.Parent)
.Where(a => a.Parent.Parent.code == "001")
.Where(a => a.JoinTest01Enum == JoinTest01Enum.f3.ToString())
.Where(a => object.Equals(a.JoinTest01Enum, JoinTest01Enum.f3))
.Where(a => new[] { JoinTest01Enum.f2, JoinTest01Enum.f3 }.Contains(a.JoinTest01Enum2))
.ToSql();