Ever build a custom code activity and wish you could just use a Task or Task<T> instead of the older BeginExecute() and EndExecute() methods?
I don’t remember where I got this but it’s something I’ve used for quite a while now.
public class MyActivity : AsyncTaskCodeActivity<string>
{
protected override async Task<string> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken token)
{
var result = await SomeAsyncMethod();
return result.Trim();
}
}
Here is the source code, licensed under the MIT license: https://gist.github.com/Foxtrek64/a0b6f58342066327f7b2eab3d832f1fb
@Bena @fandre You’d asked about this in another question last year. It’s a little late now but hopefully this can be of use to you.
Amendment: This can be consumed in a VB or F# project, but it will either need to be converted or placed in a C# class library in your solution.