Files
AobaV2/AobaServer/Utils/Extensions.cs
2025-05-03 01:09:59 -04:00

16 lines
290 B
C#

using MongoDB.Bson;
namespace AobaServer.Utils;
public static class Extensions
{
public static ObjectId ToObjectId(this string? value)
{
if(value == null)
return ObjectId.Empty;
if(ObjectId.TryParse(value, out ObjectId result))
return result;
return ObjectId.Empty;
}
}