Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created December 14, 2017 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/4eae6e1fb28d4998d66192d0b425f560 to your computer and use it in GitHub Desktop.
Save dcomartin/4eae6e1fb28d4998d66192d0b425f560 to your computer and use it in GitHub Desktop.
using System.Threading.Tasks;
using Orleans;
namespace Grains
{
public interface ICounterGrain : IGrainWithStringKey
{
Task Increment(int increment);
Task<int> GetCount();
}
public class Counter : Grain, ICounterGrain
{
private int _counter;
public Task Increment(int increment)
{
_counter += increment;
return Task.CompletedTask;
}
public Task<int> GetCount()
{
return Task.FromResult(_counter);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment