Resolve warnings

This commit is contained in:
Sipke Schoorstra 2021-06-19 11:41:02 +02:00
parent 317c8c56f2
commit 6050c99c23
7 changed files with 9 additions and 16 deletions

View file

@ -22,6 +22,6 @@ namespace Elsa.Activities.Http.Bookmarks
return methods.Select(CreateBookmark);
}
private static string? ToLower(string? s) => s?.ToLowerInvariant();
private static string ToLower(string s) => s.ToLowerInvariant();
}
}

View file

@ -34,13 +34,6 @@ namespace Elsa.Builders
IActivityBuilder StartWith<T>(string activityTypeName, Action<IActivityBuilder>? branch = default, [CallerLineNumber] int lineNumber = default, [CallerFilePath] string? sourceFile = default) where T : class, IActivity;
IActivityBuilder Add<T>(
string activityTypeName,
Action<ISetupActivity<T>>? setup,
Action<IActivityBuilder>? branch = default,
[CallerLineNumber] int lineNumber = default,
[CallerFilePath] string? sourceFile = default) where T : class, IActivity;
IActivityBuilder Add<T>(
string activityTypeName,
Action<IActivityBuilder>? branch = default,

View file

@ -31,7 +31,7 @@ namespace Elsa.Models
public Instant? FaultedAt { get; set; }
public Variables Variables { get; set; }
public WorkflowOutputReference? Output { get; set; }
public IDictionary<string, IDictionary<string, object>> ActivityData { get; set; } = new Dictionary<string, IDictionary<string, object>>();
public IDictionary<string, IDictionary<string, object?>> ActivityData { get; set; } = new Dictionary<string, IDictionary<string, object?>>();
public HashSet<BlockingActivity> BlockingActivities
{

View file

@ -179,8 +179,8 @@ namespace Elsa.Services.Models
public void SetWorkflowContext(object? value) => WorkflowExecutionContext.SetWorkflowContext(value);
public object? GetWorkflowContext() => WorkflowExecutionContext.GetWorkflowContext();
public T GetWorkflowContext<T>() => WorkflowExecutionContext.GetWorkflowContext<T>();
public IDictionary<string, object> GetActivityData() => GetActivityData(ActivityId);
public IDictionary<string, object> GetActivityData(string activityId) => WorkflowExecutionContext.GetActivityData(activityId);
public IDictionary<string, object?> GetActivityData() => GetActivityData(ActivityId);
public IDictionary<string, object?> GetActivityData(string activityId) => WorkflowExecutionContext.GetActivityData(activityId);
public Task<T?> GetActivityPropertyAsync<TActivity, T>(Expression<Func<TActivity, T>> propertyExpression, CancellationToken cancellationToken = default) where TActivity : IActivity => WorkflowExecutionContext.GetActivityPropertyAsync<TActivity, T>(ActivityId, propertyExpression, cancellationToken);
public void Fault(Exception exception) => WorkflowExecutionContext.Fault(exception, ActivityId, Input, Resuming);
}

View file

@ -66,7 +66,7 @@ namespace Elsa.Services.Models
public ScheduledActivity PopScheduledActivity() => WorkflowInstance.ScheduledActivities.Pop();
public ScheduledActivity PeekScheduledActivity() => WorkflowInstance.ScheduledActivities.Peek();
public string? CorrelationId
public string CorrelationId
{
get => WorkflowInstance.CorrelationId;
set => WorkflowInstance.CorrelationId = value;
@ -240,7 +240,7 @@ namespace Elsa.Services.Models
public object? GetWorkflowContext() => WorkflowContext;
public T GetWorkflowContext<T>() => (T) WorkflowContext!;
public IDictionary<string, object> GetActivityData(string activityId)
public IDictionary<string, object?> GetActivityData(string activityId)
{
var activityData = WorkflowInstance.ActivityData;
var state = activityData.ContainsKey(activityId) ? activityData[activityId] : default;
@ -248,7 +248,7 @@ namespace Elsa.Services.Models
if (state != null)
return state;
state = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
state = new Dictionary<string, object?>(StringComparer.OrdinalIgnoreCase);
activityData[activityId] = state;
return state;

View file

@ -51,7 +51,7 @@ namespace Elsa.Services
protected virtual RegisterTaskResult RegisterTask(Func<WorkflowExecutionContext, CancellationToken, ValueTask> task) => new(task);
protected virtual T? GetState<T>([CallerMemberName] string name = null!) => Data.GetState<T>(name);
protected virtual T GetState<T>(Func<T> defaultValue, [CallerMemberName] string name = null!) => Data.GetState(name, defaultValue);
protected virtual T? GetState<T>(Func<T> defaultValue, [CallerMemberName] string name = null!) => Data.GetState(name, defaultValue);
protected virtual void SetState(object? value, [CallerMemberName] string name = null!) => Data.SetState(name, value);
}
}

View file

@ -50,7 +50,7 @@ namespace Elsa.Services
/// <summary>
/// A data store for the activity to store information that needs to be persisted as part of the workflow instance.
/// </summary>
IDictionary<string, object> Data { get; set; }
IDictionary<string, object?> Data { get; set; }
/// <summary>
/// Returns a value of whether the specified activity can execute.