mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-21 10:59:56 +08:00
Update Mongodb
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using MongoDb.Ado.data;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
@@ -17,5 +19,17 @@ namespace MongoDb.Ado.data
|
||||
{ "deletemany", new DeleteManyHandler() },
|
||||
{ "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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,14 +57,8 @@ namespace MongoDb.Ado.data
|
||||
public override int ExecuteNonQuery()
|
||||
{
|
||||
var (operation, collectionName, json) = ParseCommand(_commandText);
|
||||
var collection = GetCollection(collectionName);
|
||||
|
||||
var handlers = ExecuteHandlerFactory.Items;
|
||||
|
||||
if (!handlers.TryGetValue(operation, out var handler))
|
||||
throw new NotSupportedException($"不支持的操作类型: {operation}");
|
||||
|
||||
return handler.Handle(collection, json);
|
||||
var collection = GetCollection(collectionName);
|
||||
return ExecuteHandlerFactory.Handler(operation, json, collection);
|
||||
}
|
||||
|
||||
public override object ExecuteScalar()
|
||||
|
||||
Reference in New Issue
Block a user