2025-05-02 15:25:47 +08:00
|
|
|
|
using MongoDB.Bson;
|
|
|
|
|
using MongoDB.Driver;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace MongoDb.Ado.data
|
|
|
|
|
{
|
|
|
|
|
public class ExecuteScalarHandler
|
|
|
|
|
{
|
2025-05-02 15:34:15 +08:00
|
|
|
|
public object Handle(string operation, IMongoCollection<BsonDocument> collection, string json)
|
2025-05-02 15:25:47 +08:00
|
|
|
|
{
|
2025-05-02 15:34:15 +08:00
|
|
|
|
using (var dbReader = new DbDataReaderFactory().Handle(operation, collection, json))
|
2025-05-02 15:25:47 +08:00
|
|
|
|
{
|
2025-05-02 15:34:15 +08:00
|
|
|
|
if (dbReader.Read())
|
|
|
|
|
{
|
|
|
|
|
return dbReader.GetValue(0);
|
|
|
|
|
}
|
|
|
|
|
return null; //
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-02 15:25:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|