mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Update Mongodb
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
using MongoDb.Ado.data;
|
using MongoDb.Ado.data;
|
||||||
|
using MongoDB.Bson;
|
||||||
|
using MongoDB.Driver;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -17,5 +19,17 @@ namespace MongoDb.Ado.data
|
|||||||
{ "deletemany", new DeleteManyHandler() },
|
{ "deletemany", new DeleteManyHandler() },
|
||||||
{ "find", new NonFindHandler() }
|
{ "find", new NonFindHandler() }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public static int Handler(string operation, string json, IMongoCollection<BsonDocument> collection)
|
||||||
|
{
|
||||||
|
var handlers = ExecuteHandlerFactory.Items;
|
||||||
|
|
||||||
|
if (!handlers.TryGetValue(operation, out var handler))
|
||||||
|
throw new NotSupportedException($"不支持的操作类型: {operation}");
|
||||||
|
|
||||||
|
return handler.Handle(collection, json);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,13 +58,7 @@ namespace MongoDb.Ado.data
|
|||||||
{
|
{
|
||||||
var (operation, collectionName, json) = ParseCommand(_commandText);
|
var (operation, collectionName, json) = ParseCommand(_commandText);
|
||||||
var collection = GetCollection(collectionName);
|
var collection = GetCollection(collectionName);
|
||||||
|
return ExecuteHandlerFactory.Handler(operation, json, collection);
|
||||||
var handlers = ExecuteHandlerFactory.Items;
|
|
||||||
|
|
||||||
if (!handlers.TryGetValue(operation, out var handler))
|
|
||||||
throw new NotSupportedException($"不支持的操作类型: {operation}");
|
|
||||||
|
|
||||||
return handler.Handle(collection, json);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object ExecuteScalar()
|
public override object ExecuteScalar()
|
||||||
|
|||||||
Reference in New Issue
Block a user