mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Update mongodb
This commit is contained in:
@@ -116,7 +116,15 @@ namespace MongoDbTest
|
|||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
Name = it.Name+"b",
|
Name = it.Name+"b",
|
||||||
Name2 = "b"+it.Name
|
Name2 = "b"+it.Name
|
||||||
}).ToDataTable();
|
}).ToDataTable();
|
||||||
|
|
||||||
|
//var list13 = db.Queryable<OrderInfo>()
|
||||||
|
// .GroupBy(it=>it.Name)
|
||||||
|
// .Select(it => new
|
||||||
|
// {
|
||||||
|
// Id = it.Name,
|
||||||
|
// Name =SqlFunc.AggregateMax(it.Id)
|
||||||
|
// }).ToList();
|
||||||
//测试生成SQL性能
|
//测试生成SQL性能
|
||||||
TestSqlBuilder(db);
|
TestSqlBuilder(db);
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Linq;
|
||||||
namespace SqlSugar.MongoDb
|
namespace SqlSugar.MongoDb
|
||||||
{
|
{
|
||||||
public class MethodCallExpressionTractor
|
public class MethodCallExpressionTractor
|
||||||
@@ -21,7 +21,25 @@ namespace SqlSugar.MongoDb
|
|||||||
{
|
{
|
||||||
return BsonValue.Create(ExpressionTool.DynamicInvoke(expr));
|
return BsonValue.Create(ExpressionTool.DynamicInvoke(expr));
|
||||||
}
|
}
|
||||||
return null;
|
else
|
||||||
|
{
|
||||||
|
var methodCallExpression = expr as MethodCallExpression;
|
||||||
|
var name = methodCallExpression.Method.Name;
|
||||||
|
BsonValue result = null;
|
||||||
|
if (typeof(IDbMethods).GetMethods().Any(it => it.Name == name))
|
||||||
|
{
|
||||||
|
var context = new MongoDbMethod();
|
||||||
|
MethodCallExpressionModel model = new MethodCallExpressionModel();
|
||||||
|
var args= methodCallExpression.Arguments;
|
||||||
|
foreach (var item in args)
|
||||||
|
{
|
||||||
|
//开发中
|
||||||
|
}
|
||||||
|
var funcString= context.GetType().GetMethod(name).Invoke(context, new object[] { model });
|
||||||
|
result = BsonValue.Create(funcString);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user