Fix workflow context type nullability

This commit is contained in:
Sipke Schoorstra 2021-04-15 15:48:04 +02:00
parent c1f827cfee
commit 18f45fe241
2 changed files with 2 additions and 2 deletions

View file

@ -13,7 +13,7 @@ namespace Elsa.Services.Models
public WorkflowExecutionContext WorkflowExecutionContext { get; }
public IWorkflowBlueprint WorkflowBlueprint => WorkflowExecutionContext.WorkflowBlueprint;
public WorkflowInstance WorkflowInstance => WorkflowExecutionContext.WorkflowInstance;
public Type ContextType => WorkflowBlueprint.ContextOptions!.ContextType;
public Type? ContextType => WorkflowBlueprint.ContextOptions?.ContextType;
public string ContextId => WorkflowInstance.ContextId!;
}
}

View file

@ -21,7 +21,7 @@ namespace Elsa.Services
public async ValueTask<object?> LoadContext(LoadWorkflowContext context, CancellationToken cancellationToken = default)
{
var provider = GetRefresher(context.ContextType);
var provider = context.ContextType != null ? GetRefresher(context.ContextType) : null;
return provider == null ? null : await provider.LoadAsync(context, cancellationToken);
}