mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Synchronous code
This commit is contained in:
@@ -21,6 +21,7 @@ namespace SqlSugar.MongoDb
|
||||
_context = context;
|
||||
_visitorContext = visitorContext;
|
||||
}
|
||||
|
||||
public BsonValue Extract(Expression expr)
|
||||
{
|
||||
if (ExpressionTool.GetParameters(expr).Count == 0)
|
||||
@@ -46,7 +47,7 @@ namespace SqlSugar.MongoDb
|
||||
{
|
||||
return InvokeMongoMethod(name, out result, context, model);
|
||||
}
|
||||
else if (name.StartsWith("Add"))
|
||||
else if (IsAddMethod(name))
|
||||
{
|
||||
result = AddDateByType(name, context, model);
|
||||
}
|
||||
@@ -68,6 +69,7 @@ namespace SqlSugar.MongoDb
|
||||
}
|
||||
}
|
||||
|
||||
#region Core
|
||||
private BsonValue InvokeMongoMethod(string name, out BsonValue result, MongoDbMethod context, MethodCallExpressionModel model)
|
||||
{
|
||||
if (name == nameof(ToString))
|
||||
@@ -178,11 +180,6 @@ namespace SqlSugar.MongoDb
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsEndCondition(string name)
|
||||
{
|
||||
return name == "End";
|
||||
}
|
||||
|
||||
public BsonValue BuildMongoSwitch(List<KeyValuePair<string, Expression>> ifConditions)
|
||||
{
|
||||
if (ifConditions == null || ifConditions.Count < 3)
|
||||
@@ -257,7 +254,6 @@ namespace SqlSugar.MongoDb
|
||||
return switchDoc;
|
||||
}
|
||||
|
||||
|
||||
private static string TransformMethodName(MethodCallExpression methodCallExpression, string name)
|
||||
{
|
||||
if (name == "ToDateTime")
|
||||
@@ -288,9 +284,21 @@ namespace SqlSugar.MongoDb
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper
|
||||
private static bool IsEndCondition(string name)
|
||||
{
|
||||
return name == "End";
|
||||
}
|
||||
private static bool IsCountJson(MethodCallExpression methodCallExpression, string name)
|
||||
{
|
||||
return name == "Count" && methodCallExpression?.Arguments?.FirstOrDefault() is MemberExpression m;
|
||||
}
|
||||
private static bool IsAddMethod(string name)
|
||||
{
|
||||
return name.StartsWith("Add");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user