Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for Orleans Bank Account sample. #7019

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions orleans/BankAccount/AccountTransfer.Grains/AccountGrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace AccountTransfer.Grains;

[GenerateSerializer, Immutable]
public record class Balance
[GenerateSerializer]
public class class Balance
{
public int Value { get; init; } = 1_000;
public int Value { get; set; } = 1_000;
}

[Reentrant]
Expand All @@ -21,7 +21,7 @@ public AccountGrain(

public Task Deposit(int amount) =>
_balance.PerformUpdate(
balance => balance with { Value = balance.Value + amount });
balance => balance.Value += amount);

public Task Withdraw(int amount) =>
_balance.PerformUpdate(balance =>
Expand All @@ -34,7 +34,7 @@ public Task Withdraw(int amount) =>
$" This account has {balance.Value} credits.");
}

return balance with { Value = balance.Value + amount };
balance = balance.Value -= amount;
});

public Task<int> GetBalance() =>
Expand Down