File tree Expand file tree Collapse file tree
orleans/BankAccount/AccountTransfer.Grains Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55namespace AccountTransfer . Grains ;
66
7- [ GenerateSerializer , Immutable ]
8- public record class Balance
7+ [ GenerateSerializer ]
8+ public class class Balance
99{
10- public int Value { get ; init ; } = 1_000 ;
10+ public int Value { get ; set ; } = 1_000 ;
1111}
1212
1313[ Reentrant ]
@@ -21,7 +21,7 @@ public AccountGrain(
2121
2222 public Task Deposit ( int amount ) =>
2323 _balance . PerformUpdate (
24- balance => balance with { Value = balance . Value + amount } ) ;
24+ balance => balance . Value += amount ) ;
2525
2626 public Task Withdraw ( int amount ) =>
2727 _balance . PerformUpdate ( balance =>
@@ -34,7 +34,7 @@ public Task Withdraw(int amount) =>
3434 $ " This account has { balance . Value } credits.") ;
3535 }
3636
37- return balance with { Value = balance . Value + amount } ;
37+ balance = balance . Value -= amount ;
3838 } ) ;
3939
4040 public Task < int > GetBalance ( ) =>
You can’t perform that action at this time.
0 commit comments