mirror of
https://github.com/nsnail/FreeSql.git
synced 2026-03-06 11:43:24 +08:00
- 增加 Pgsql JToken/JObject/JArray 索引访问的表达式解析;
- 增加 object.Equals 表达式解析;
This commit is contained in:
@@ -369,7 +369,7 @@ namespace FreeSql.Tests.PostgreSQL
|
||||
var item3NP = insert.AppendData(item2).NoneParameter().ExecuteInserted();
|
||||
|
||||
var item3 = insert.AppendData(item2).ExecuteInserted().First();
|
||||
var newitem2 = select.Where(a => a.Id == item3.Id).ToOne();
|
||||
var newitem2 = select.Where(a => a.Id == item3.Id && object.Equals(a.testFieldJToken["a"], "1")).ToOne();
|
||||
|
||||
var items = select.ToList();
|
||||
}
|
||||
|
||||
@@ -963,6 +963,15 @@ WHERE (((cast(a.[Id] as nvarchar)) in (SELECT b.[Title]
|
||||
a.Id,
|
||||
a.Clicks
|
||||
});
|
||||
|
||||
var testUnionAll = select
|
||||
.WithSql("SELECT * FROM [tb_topic22] where id = 10")
|
||||
.WithSql("SELECT * FROM [tb_topic22] where id = 11")
|
||||
.ToSql(a => new
|
||||
{
|
||||
a.Id,
|
||||
a.Clicks
|
||||
});
|
||||
}
|
||||
|
||||
public class TestInclude_OneToManyModel1
|
||||
|
||||
@@ -2961,6 +2961,40 @@
|
||||
<param name="end"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSqlGlobalExpressionCall.Contains``2(System.Collections.Generic.IEnumerable{System.ValueTuple{``0,``1}},``0,``1)">
|
||||
<summary>
|
||||
C#:从元组集合中查找 exp1, exp2 是否存在<para></para>
|
||||
SQL: <para></para>
|
||||
exp1 = that[0].Item1 and exp2 = that[0].Item2 OR <para></para>
|
||||
exp1 = that[1].Item1 and exp2 = that[1].Item2 OR <para></para>
|
||||
... <para></para>
|
||||
注意:当 that 为 null 或 empty 时,返回 1=0
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="exp1"></param>
|
||||
<param name="exp2"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSqlGlobalExpressionCall.Contains``3(System.Collections.Generic.IEnumerable{System.ValueTuple{``0,``1,``2}},``0,``1,``2)">
|
||||
<summary>
|
||||
C#:从元组集合中查找 exp1, exp2, exp2 是否存在<para></para>
|
||||
SQL: <para></para>
|
||||
exp1 = that[0].Item1 and exp2 = that[0].Item2 and exp3 = that[0].Item3 OR <para></para>
|
||||
exp1 = that[1].Item1 and exp2 = that[1].Item2 and exp3 = that[1].Item3 OR <para></para>
|
||||
... <para></para>
|
||||
注意:当 that 为 null 或 empty 时,返回 1=0
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<typeparam name="T3"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="exp1"></param>
|
||||
<param name="exp2"></param>
|
||||
<param name="exp3"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSqlGlobalExtensions.Distance(System.Drawing.Point,System.Drawing.Point)">
|
||||
<summary>
|
||||
测量两个经纬度的距离,返回单位:米
|
||||
@@ -3234,49 +3268,3 @@
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
<EFBFBD><EFBFBD><EFBFBD>琜<EFBFBD><EFBFBD>航<EFBFBD>嚗㕑◤<EFBFBD>嗡<EFBFBD>蝥輻<EFBFBD>鈭见𦛚<EFBFBD>芸𢆡<EFBFBD>𣂷漱
|
||||
</summary>
|
||||
<param name="handler">鈭见𦛚雿<EFBFBD> () => {}</param>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Transaction(System.TimeSpan,System.Action)">
|
||||
<summary>
|
||||
撘<><E69298>臭<EFBFBD><E887AD>∴<EFBFBD>銝齿𣈲<E9BDBF><F0A388B2><EFBFBD>甇伐<E79487>
|
||||
</summary>
|
||||
<param name="timeout">頞<EFBFBD>𧒄嚗峕𧊋<EFBFBD>扯<EFBFBD>摰峕<EFBFBD>嚗<EFBFBD>虾<EFBFBD>踝<EFBFBD>鋡怠<EFBFBD>隞𣇉瑪蝔衤<EFBFBD><EFBFBD>∟䌊<EFBFBD>冽<EFBFBD>鈭<EFBFBD></param>
|
||||
<param name="handler">鈭见𦛚雿<EFBFBD> () => {}</param>
|
||||
</member>
|
||||
<member name="M:IFreeSql.Transaction(System.Data.IsolationLevel,System.TimeSpan,System.Action)">
|
||||
<summary>
|
||||
撘<><E69298>臭<EFBFBD><E887AD>∴<EFBFBD>銝齿𣈲<E9BDBF><F0A388B2><EFBFBD>甇伐<E79487>
|
||||
</summary>
|
||||
<param name="isolationLevel"></param>
|
||||
<param name="handler">鈭见𦛚雿<EFBFBD> () => {}</param>
|
||||
<param name="timeout">頞<EFBFBD>𧒄嚗峕𧊋<EFBFBD>扯<EFBFBD>摰峕<EFBFBD>嚗<EFBFBD>虾<EFBFBD>踝<EFBFBD>鋡怠<EFBFBD>隞𣇉瑪蝔衤<EFBFBD><EFBFBD>∟䌊<EFBFBD>冽<EFBFBD>鈭<EFBFBD></param>
|
||||
</member>
|
||||
<member name="P:IFreeSql.Ado">
|
||||
<summary>
|
||||
<20>唳旿摨栞挪<E6A09E>桀笆鞊<E7AC86>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.Aop">
|
||||
<summary>
|
||||
<20><><EFBFBD>㗇㜃<E39787>芣䲮瘜閖<E7989C><E99696>刻<EFBFBD><E588BB><EFBFBD>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.CodeFirst">
|
||||
<summary>
|
||||
CodeFirst 璅∪<E79285>撘<EFBFBD><E69298>𤑳㮾<F0A491B3>單䲮瘜<E4B2AE>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.DbFirst">
|
||||
<summary>
|
||||
DbFirst 璅∪<E79285>撘<EFBFBD><E69298>𤑳㮾<F0A491B3>單䲮瘜<E4B2AE>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IFreeSql.GlobalFilter">
|
||||
<summary>
|
||||
<20>典<EFBFBD>餈<EFBFBD>誘霈曄蔭嚗<E894AD>虾暺䁅恕<E48185><E68195><EFBFBD>銝<EFBFBD> Select/Update/Delete <20>∩辣
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -675,8 +675,11 @@ namespace FreeSql.Internal
|
||||
case "System.Convert": other3Exp = ExpressionLambdaToSqlCallConvert(exp3, tsc); break;
|
||||
}
|
||||
if (string.IsNullOrEmpty(other3Exp) == false) return other3Exp;
|
||||
if (exp3.Method.Name == "Equals" && exp3.Object != null && exp3.Arguments.Count > 0)
|
||||
return ExpressionBinary("=", exp3.Object, exp3.Arguments[0], tsc);
|
||||
if (exp3.Method.Name == "Equals")
|
||||
{
|
||||
if (exp3.Arguments.Count > 0 && exp3.Object != null) return ExpressionBinary("=", exp3.Object, exp3.Arguments[0], tsc);
|
||||
if (exp3.Arguments.Count > 1 && exp3.Method.DeclaringType == typeof(object)) return ExpressionBinary("=", exp3.Arguments[0], exp3.Arguments[1], tsc);
|
||||
}
|
||||
if (callType.FullName.StartsWith("FreeSql.ISelectGroupingAggregate`"))
|
||||
{
|
||||
//if (exp3.Type == typeof(string) && exp3.Arguments.Any() && exp3.Arguments[0].NodeType == ExpressionType.Constant) {
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace FreeSql.PostgreSQL
|
||||
left = objExp == null ? null : getExp(objExp);
|
||||
switch (callExp.Method.Name)
|
||||
{
|
||||
case "get_Item": return $"{left}->{getExp(callExp.Arguments[argIndex])}";
|
||||
case "Any": return $"(jsonb_array_length(coalesce({left},'[]')) > 0)";
|
||||
case "Contains":
|
||||
var json = getExp(callExp.Arguments[argIndex]);
|
||||
|
||||
Reference in New Issue
Block a user