Skip to content

Commit

Permalink
override OnComputeId in AdaptiveSkillDialog (#3882)
Browse files Browse the repository at this point in the history
* override OnComputeId in AdaptiveSkillDialog

* refactor AdaptiveSkillDialog.OnComputeId()

* remove superfluous parenthesis around activity

* apply @Stevenic's PR feedback
  • Loading branch information
stevengum committed May 8, 2020
1 parent f2c2f43 commit f8c200b
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using AdaptiveExpressions.Properties;
using Microsoft.Bot.Builder.Dialogs.Adaptive.Templates;
using Microsoft.Bot.Builder.Skills;
using Microsoft.Bot.Schema;
using Newtonsoft.Json;
Expand Down Expand Up @@ -161,5 +162,22 @@ public override Task<DialogTurnResult> ContinueDialogAsync(DialogContext dc, Can

return base.ContinueDialogAsync(dc, cancellationToken);
}

protected override string OnComputeId()
{
var appId = SkillAppId?.ToString() ?? string.Empty;
string activity;

if (Activity is ActivityTemplate at)
{
activity = StringUtils.Ellipsis(at.Template.Trim(), 30);
}
else
{
activity = StringUtils.Ellipsis(Activity?.ToString().Trim(), 30);
}

return $"{this.GetType().Name}['{appId}','{activity}']";
}
}
}

0 comments on commit f8c200b

Please sign in to comment.