Browse Source

Added missing file.

pull/908/head
Sebastian 3 years ago
parent
commit
78d972e6fd
  1. 40
      backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonDefaultConventions.cs

40
backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonDefaultConventions.cs

@ -0,0 +1,40 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Conventions;
namespace Squidex.Infrastructure.MongoDb
{
public static class BsonDefaultConventions
{
private static bool isRegistered;
public static void Register()
{
try
{
if (isRegistered)
{
return;
}
ConventionRegistry.Register("IgnoreExtraElements", new ConventionPack
{
new IgnoreExtraElementsConvention(true)
}, t => true);
isRegistered = true;
}
catch (BsonSerializationException)
{
return;
}
}
}
}
Loading…
Cancel
Save