mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-24 16:43:17 +08:00
Update mongodb
This commit is contained in:
@@ -9,7 +9,7 @@ namespace MongoDb.Ado.data
|
||||
{
|
||||
public class ExecuteHandlerFactory
|
||||
{
|
||||
public readonly static Dictionary<string, IMongoOperationHandler> Items = new Dictionary<string, IMongoOperationHandler>(StringComparer.OrdinalIgnoreCase)
|
||||
public readonly Dictionary<string, IMongoOperationHandler> Items = new Dictionary<string, IMongoOperationHandler>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "insert", new InsertHandler() },
|
||||
{ "insertmany", new InsertManyHandler() },
|
||||
@@ -25,7 +25,7 @@ namespace MongoDb.Ado.data
|
||||
public static int Handler(string operation, string json, IMongoCollection<BsonDocument> collection, HandlerContext handlerContext)
|
||||
{
|
||||
MongoDbMethodUtils.ValidateOperation(operation);
|
||||
var handlers = ExecuteHandlerFactory.Items;
|
||||
var handlers =new ExecuteHandlerFactory().Items;
|
||||
|
||||
if (!handlers.TryGetValue(operation, out var handler))
|
||||
throw new NotSupportedException($"不支持的操作类型: {operation}");
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace MongoDb.Ado.data
|
||||
{
|
||||
public class ExecuteHandlerFactoryAsync
|
||||
{
|
||||
public readonly static Dictionary<string, IMongoOperationHandlerAsync> Items = new Dictionary<string, IMongoOperationHandlerAsync>(StringComparer.OrdinalIgnoreCase)
|
||||
public readonly Dictionary<string, IMongoOperationHandlerAsync> Items = new Dictionary<string, IMongoOperationHandlerAsync>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "insert", new InsertHandlerAsync() },
|
||||
{ "insertmany", new InsertManyHandlerAsync() },
|
||||
@@ -28,7 +28,7 @@ namespace MongoDb.Ado.data
|
||||
public static Task<int> HandlerAsync(string operation, string json, IMongoCollection<BsonDocument> collection,CancellationToken cancellationToken, HandlerContext handlerContext)
|
||||
{
|
||||
MongoDbMethodUtils.ValidateOperation(operation);
|
||||
var handlers = ExecuteHandlerFactoryAsync.Items;
|
||||
var handlers = new ExecuteHandlerFactoryAsync().Items;
|
||||
|
||||
if (!handlers.TryGetValue(operation, out var handler))
|
||||
throw new NotSupportedException($"不支持的操作类型: {operation}");
|
||||
|
||||
Reference in New Issue
Block a user