-
Notifications
You must be signed in to change notification settings - Fork 2k
/
TransactionCommitterTestGrain.cs
32 lines (28 loc) · 1.13 KB
/
TransactionCommitterTestGrain.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Orleans.Transactions.Abstractions;
namespace Orleans.Transactions.TestKit
{
public class TransactionCommitterTestGrain : Grain, ITransactionCommitterTestGrain
{
protected ITransactionCommitter<IRemoteCommitService> committer;
private readonly ILoggerFactory loggerFactory;
protected ILogger logger;
public TransactionCommitterTestGrain(
[TransactionCommitter(TransactionTestConstants.RemoteCommitService, TransactionTestConstants.TransactionStore)] ITransactionCommitter<IRemoteCommitService> committer,
ILoggerFactory loggerFactory)
{
this.committer = committer;
this.loggerFactory = loggerFactory;
}
public override Task OnActivateAsync()
{
this.logger = this.loggerFactory.CreateLogger(this.GetGrainIdentity().ToString());
return base.OnActivateAsync();
}
public Task Commit(ITransactionCommitOperation<IRemoteCommitService> operation)
{
return this.committer.OnCommit(operation);
}
}
}