Skip to content

Instantly share code, notes, and snippets.

@cgillum
Last active May 24, 2019 00:33
Show Gist options
  • Save cgillum/acc80ad20c31c3cdb2aa90037bdecccf to your computer and use it in GitHub Desktop.
Save cgillum/acc80ad20c31c3cdb2aa90037bdecccf to your computer and use it in GitHub Desktop.
Example of "counter" entity written as a C# class
public class CounterEntity
{
[JsonProperty("value")]
public int CurrentValue { get; set; }
public void Add(int amount) => this.CurrentValue += amount;
public void Reset() => this.CurrentValue = 0;
public int Get() => this.CurrentValue;
[FunctionName("Counter")]
public static Task Run([EntityTrigger] IDurableEntityContext ctx)
=> ctx.DispatchAsync<CounterEntity>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment