Update mongodb

This commit is contained in:
sunkaixuan
2025-11-21 17:17:04 +08:00
parent 0d20cc8c1c
commit d302496f2c
2 changed files with 4 additions and 4 deletions

View File

@@ -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}");

View File

@@ -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}");