Fix MongoDb (#540)

This commit is contained in:
Rafael Carnucci 2020-12-25 21:16:55 +01:00 committed by GitHub
parent f6685189f7
commit 79b5b89505
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -20,7 +20,7 @@ namespace Elsa.Models
Data = data;
}
public string? TenantId { get; }
public string? TenantId { get; private set; }
public string WorkflowInstanceId { get; set; } = default!;
public string ActivityId { get; set; } = default!;
public Instant Timestamp { get; set; }= default!;

View file

@ -1,4 +1,5 @@
using System;
using System.Security.Cryptography.X509Certificates;
using Elsa.Models;
using Elsa.Persistence.MongoDb.Serializers;
using MongoDb.Bson.NodaTime;
@ -22,22 +23,25 @@ namespace Elsa.Persistence.MongoDb.Services
private static bool Map()
{
if (BsonClassMap.IsClassMapRegistered(typeof(WorkflowDefinition)))
if (BsonClassMap.IsClassMapRegistered(typeof(Entity)))
return false;
try
{
BsonClassMap.RegisterClassMap<Entity>(cm =>
{
cm.SetIsRootClass(true);
cm.MapIdProperty(x => x.Id);
});
BsonClassMap.RegisterClassMap<WorkflowDefinition>(cm =>
{
cm.AutoMap();
cm.MapIdMember(x => x.Id);
cm.AutoMap();
});
BsonClassMap.RegisterClassMap<WorkflowInstance>(cm =>
{
cm.AutoMap();
cm.MapIdMember(x => x.Id);
cm.AutoMap();
});
}