Skip to content

Commit 1ef942a

Browse files
committed
Add enum to string convention
1 parent 18e9522 commit 1ef942a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/providers/WorkflowCore.Persistence.MongoDB/Services/MongoPersistenceProvider.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using System.Collections.Generic;
66
using System.Linq;
77
using System.Threading.Tasks;
8+
using MongoDB.Bson;
9+
using MongoDB.Bson.Serialization.Conventions;
810
using MongoDB.Driver.Linq;
911
using WorkflowCore.Interface;
1012
using WorkflowCore.Models;
@@ -24,6 +26,13 @@ public MongoPersistenceProvider(IMongoDatabase database)
2426

2527
static MongoPersistenceProvider()
2628
{
29+
ConventionRegistry.Register(
30+
"workflow.conventions",
31+
new ConventionPack
32+
{
33+
new EnumRepresentationConvention(BsonType.String)
34+
}, t => t.FullName?.StartsWith("WorkflowCore") ?? false);
35+
2736
BsonClassMap.RegisterClassMap<WorkflowInstance>(x =>
2837
{
2938
x.MapIdProperty(y => y.Id)

0 commit comments

Comments
 (0)