# ExclusiveLockTransactionTestGrain Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.transactions.testkit.base/orleans.transactions.testkit.exclusivelocktransactiontestgrain/)

## Add(int) {#add-int-68e3ca00}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.transactions.testkit.base/orleans.transactions.testkit.exclusivelocktransactiontestgrain/methods/add-int-68e3ca00/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Transactions.TestKit.Base/Grains/ExclusiveLockTransactionTestGrain.cs#L41-L49)

```csharp
public Task<int[]> Add(int numberToAdd)
```

apply add operation to every transaction state

### Parameters

- `numberToAdd` (`int`)

## Get {#get-26d30193}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.transactions.testkit.base/orleans.transactions.testkit.exclusivelocktransactiontestgrain/methods/get-26d30193/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Transactions.TestKit.Base/Grains/ExclusiveLockTransactionTestGrain.cs#L53-L59)

```csharp
public Task<int[]> Get()
```

apply get operation to every transaction state with exclusive lock

## OnActivateAsync(CancellationToken) {#onactivateasync-system-threading-cancellationtoken-2272da96}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.transactions.testkit.base/orleans.transactions.testkit.exclusivelocktransactiontestgrain/methods/onactivateasync-system-threading-cancellationtoken-2272da96/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Transactions.TestKit.Base/Grains/ExclusiveLockTransactionTestGrain.cs#L25-L26)

```csharp
public override Task OnActivateAsync(CancellationToken cancellationToken)
```

This method is called at the end of the process of activating a grain. It is called before any messages have been dispatched to the grain. For grains with declared persistent state, this method is called after the State property has been populated.

### Parameters

- `cancellationToken` (`CancellationToken`): A cancellation token which signals when activation is being canceled.

## Set(int) {#set-int-058ef0e0}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.transactions.testkit.base/orleans.transactions.testkit.exclusivelocktransactiontestgrain/methods/set-int-058ef0e0/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Transactions.TestKit.Base/Grains/ExclusiveLockTransactionTestGrain.cs#L31-L37)

```csharp
public Task Set(int newValue)
```

apply set operation to every transaction state

### Parameters

- `newValue` (`int`)
