Add : QueryableByObject.ToTree

This commit is contained in:
sunkaixuan 2023-11-12 14:28:54 +08:00
parent 385b844c38
commit aaf47e7824

View File

@ -283,6 +283,14 @@ namespace SqlSugar
var reslt = method.Invoke(QueryableObj, new object[] { });
return Convert.ToBoolean(reslt);
}
public object ToTree(string childPropertyName, string parentIdPropertyName, object rootValue, string primaryKeyPropertyName)
{
var method = QueryableObj.GetType().GetMyMethod("ToTree", 4,typeof(string),typeof(string),typeof(object),typeof(string));
var reslt = method.Invoke(QueryableObj, new object[] {childPropertyName,parentIdPropertyName,rootValue,primaryKeyPropertyName });
return reslt;
}
#endregion
#region Result Async
@ -323,6 +331,13 @@ namespace SqlSugar
var task = (Task)method.Invoke(QueryableObj, new object[] { pkValue });
return await GetTask(task).ConfigureAwait(false);
}
public async Task<object> ToTreeAsync(string childPropertyName, string parentIdPropertyName, object rootValue, string primaryKeyPropertyName)
{
var method = QueryableObj.GetType().GetMyMethod("ToTreeAsync", 4, typeof(string), typeof(string), typeof(object), typeof(string));
var task =(Task)method.Invoke(QueryableObj, new object[] { childPropertyName, parentIdPropertyName, rootValue, primaryKeyPropertyName });
return await GetTask(task).ConfigureAwait(false);
}
#endregion
#region Helper