Skip to content

Commit a163b11

Browse files
committed
Ensure entity type is registered for EntityEntry
Fixes #261
1 parent bd0cd9b commit a163b11

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/MongoFramework/Infrastructure/EntityEntry.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using MongoDB.Bson;
3+
using MongoFramework.Infrastructure.Mapping;
34

45
namespace MongoFramework.Infrastructure
56
{
@@ -33,6 +34,9 @@ public EntityEntry(object entity, EntityEntryState state)
3334
Entity = entity;
3435
EntityType = entity.GetType();
3536

37+
// Ensure the entity type is registered before we potentially serialize the entity to a BSON document
38+
EntityMapping.TryRegisterType(EntityType, out _);
39+
3640
if (state == EntityEntryState.NoChanges)
3741
{
3842
OriginalValues = Entity.ToBsonDocument();

0 commit comments

Comments
 (0)