mirror of https://github.com/Squidex/squidex.git
1 changed files with 40 additions and 0 deletions
@ -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…
Reference in new issue