=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
+3
View File
@@ -5,6 +5,7 @@ namespace adas_core.Domain.Utils;
/// <summary>
/// Provides static utility methods for working with BSON (Binary JSON) data.
/// </summary>
/// <!-- aidoc:v1 sig=bd71742 -->
public static class BsonUtils
{
/// <summary>
@@ -12,6 +13,7 @@ public static class BsonUtils
/// </summary>
/// <param name="val">The <see cref="BsonValue"/> instance to convert to a CLR object.</param>
/// <returns>The underlying CLR value when <paramref name="val"/> is an Int32, Int64, Double, valid DateTime (in UTC), or String; otherwise <see langword="null"/>.</returns>
/// <!-- aidoc:v1 sig=29fed77 body=dde4c14 -->
public static object? ToObject(this BsonValue val)
{
if (val.IsInt32) return val.AsInt32;
@@ -33,6 +35,7 @@ public static class BsonUtils
/// <param name="doc">The BSON document to search for the key.</param>
/// <param name="key">The key of the value to retrieve.</param>
/// <returns>The <see cref="BsonValue"/> associated with <paramref name="key"/>, or <c>null</c> if the key does not exist.</returns>
/// <!-- aidoc:v1 sig=1ab6e35 body=441c98c -->
public static BsonValue? Get(this BsonDocument doc, string key)
{
return doc.TryGetValue(key, out var value) ? value : null;