This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IBankAccountGrain : IGrainWithGuidKey | |
{ | |
Task Deposit(decimal amount); | |
Task Withdraw(decimal amount); | |
Task<decimal> Balance(); | |
} | |
public class BankAccountGrain : JournaledGrain<BankAccountState>, IBankAccountGrain | |
{ | |
public Task Deposit(decimal amount) | |
{ | |
RaiseEvent(new Deposited | |
{ | |
Amount = amount | |
}); | |
return ConfirmEvents(); | |
} | |
public Task Withdraw(decimal amount) | |
{ | |
RaiseEvent(new Withdrawn | |
{ | |
Amount = amount | |
}); | |
return ConfirmEvents(); | |
} | |
public Task<decimal> Balance() | |
{ | |
return Task.FromResult(State.Balance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment