mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
Update mongodb
This commit is contained in:
@@ -12,24 +12,21 @@ namespace MongoDb.Ado.data
|
||||
{
|
||||
public class DbDataReaderFactory
|
||||
{
|
||||
public readonly static Dictionary<string, IQueryHandler> Items = new Dictionary<string, IQueryHandler>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "find", new QueryFindHandler() },
|
||||
{ "aggregate", new QueryFindHandler() },
|
||||
};
|
||||
public DbDataReader Handle(string operation, IMongoCollection<BsonDocument> collection, string json)
|
||||
{
|
||||
var doc = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonValue>(json);
|
||||
IQueryHandler queryHandler = null;
|
||||
if (operation == "find")
|
||||
DbDataReaderFactory.Items.TryGetValue(operation, out var handler);
|
||||
if (handler==null)
|
||||
{
|
||||
queryHandler = new QueryFindHandler();
|
||||
}
|
||||
else if (operation == "aggregate")
|
||||
{
|
||||
queryHandler = new QueryAggregateHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
ExecuteHandlerFactory.Handler(operation,json, collection);
|
||||
ExecuteHandlerFactory.Handler(operation, json, collection);
|
||||
return new DataTable().CreateDataReader();
|
||||
}
|
||||
return queryHandler.Handler(collection, doc);
|
||||
return handler.Handler(collection, doc);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user