-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add activity output example * Update Sample17 * Extend SMTP options (#107) * Remove unused imports * Update Elsa.Scrutor package reference
- Loading branch information
1 parent
1b22bac
commit d7fc571
Showing
30 changed files
with
201 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/activities/Elsa.Activities.Email/Options/SmtpCredentials.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Elsa.Activities.Email.Options | ||
{ | ||
public class SmtpCredentials | ||
{ | ||
public string Username { get; set; } | ||
public string Password { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
using System; | ||
using System.Net.Mail; | ||
|
||
namespace Elsa.Activities.Email.Options | ||
{ | ||
public class SmtpOptions | ||
{ | ||
public string Host { get; set; } | ||
public int Port { get; set; } | ||
public string DefaultSender { get; set; } | ||
public SmtpCredentials Credentials { get; set; } | ||
public TimeSpan? Timeout { get; set; } | ||
public SmtpDeliveryFormat? DeliveryFormat { get; set; } | ||
public SmtpDeliveryMethod? DeliveryMethod { get; set; } | ||
public bool? EnableSsl { get; set; } | ||
public string PickupDirectoryLocation { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/persistence/Elsa.Persistence.MongoDb/Extensions/ServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/persistence/Elsa.Persistence.MongoDb/Services/MongoWorkflowDefinitionStore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Elsa.Expressions; | ||
using Elsa.Extensions; | ||
using Elsa.Results; | ||
using Elsa.Services; | ||
using Elsa.Services.Models; | ||
using Sample17.Models; | ||
|
||
namespace Sample17.Activities | ||
{ | ||
public class CreatePerson : Activity | ||
{ | ||
private readonly IWorkflowExpressionEvaluator expressionEvaluator; | ||
|
||
public CreatePerson(IWorkflowExpressionEvaluator expressionEvaluator) | ||
{ | ||
this.expressionEvaluator = expressionEvaluator; | ||
} | ||
|
||
public WorkflowExpression<string> TitleExpression | ||
{ | ||
get => GetState<WorkflowExpression<string>>(); | ||
set => SetState(value); | ||
} | ||
|
||
public WorkflowExpression<int> AgeExpression | ||
{ | ||
get => GetState<WorkflowExpression<int>>(); | ||
set => SetState(value); | ||
} | ||
|
||
protected override async Task<ActivityExecutionResult> OnExecuteAsync( | ||
WorkflowExecutionContext context, | ||
CancellationToken cancellationToken) | ||
{ | ||
var name = await expressionEvaluator.EvaluateAsync(TitleExpression, context, cancellationToken); | ||
var age = await expressionEvaluator.EvaluateAsync(AgeExpression, context, cancellationToken); | ||
var person = new Person { FullName = name, Age = age }; | ||
|
||
Output["Person"] = person; | ||
return Done(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Elsa.Activities.Console.Activities; | ||
using Elsa.Activities.Primitives; | ||
using Elsa.Expressions; | ||
using Elsa.Services; | ||
using Elsa.Services.Models; | ||
using Sample17.Activities; | ||
using Sample17.Models; | ||
|
||
namespace Sample17 | ||
{ | ||
public class CreatePersonWorkflow : IWorkflow | ||
{ | ||
public void Build(IWorkflowBuilder builder) | ||
{ | ||
builder | ||
.StartWith<WriteLine>(x => x.TextExpression = new LiteralExpression("Enter name:")) | ||
.Then<ReadLine>().WithId("NameInput") | ||
.Then<WriteLine>(x => x.TextExpression = new LiteralExpression("Enter age:")) | ||
.Then<ReadLine>().WithId("AgeInput") | ||
.Then<CreatePerson>( | ||
x => | ||
{ | ||
x.TitleExpression = new JavaScriptExpression<string>("NameInput.Input"); | ||
x.AgeExpression = new JavaScriptExpression<int>("AgeInput.Input"); | ||
}).WithId("CreatePerson") | ||
.Then<SetVariable>( | ||
x => | ||
{ | ||
x.VariableName = "Person"; | ||
x.ValueExpression = new JavaScriptExpression<Person>("CreatePerson.Person"); | ||
}) | ||
.Then<SetVariable>( | ||
x => | ||
{ | ||
x.VariableName = "Age"; | ||
x.ValueExpression = new JavaScriptExpression<int>("CreatePerson.Person.Age"); | ||
}) | ||
.Then<WriteLine>(x => x.TextExpression = new JavaScriptExpression<string>("`A new person was created with name \"${Person.FullName}\" and age \"${Age}\"`")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Sample17.Models | ||
{ | ||
public class Person | ||
{ | ||
public string FullName { get; set; } | ||
public int Age { get; set; } | ||
|
||
public override string ToString() => FullName; | ||
} | ||
} |
Oops, something went wrong.