forked from derekfinlinson/JourneyTeam.Xrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseWorkflowActivity.cs
46 lines (40 loc) · 1.37 KB
/
BaseWorkflowActivity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Activities;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
namespace Xrm
{
public abstract class BaseWorkflowActivity : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
// Get local workflow context
var workflowContext = new BaseWorkflowActivityContext(context, this);
workflowContext.Trace($"Entered {workflowContext.WorkflowTypeName}.Execute()");
try
{
// Invoke the custom implementation
ExecuteWorkflowActivity(workflowContext);
}
catch (FaultException<OrganizationServiceFault> e)
{
workflowContext.Trace($"Exception: {e}");
// Handle the exception.
throw;
}
finally
{
workflowContext.Trace($"Exiting {workflowContext.WorkflowTypeName}.Execute()");
}
}
/// <summary>
/// Execution method for the workflow activity
/// </summary>
/// <param name="localContext">Context for the current plug-in.</param>
public abstract void ExecuteWorkflowActivity(IExtendedWorkflowContext context);
}
}