# UseExclusiveLockAttribute

Package: [Microsoft.Orleans.Transactions](/orleans/docs/api/csharp/microsoft.orleans.transactions/) 10.0.0

[NuGet package](https://www.nuget.org/packages/Microsoft.Orleans.Transactions)

```csharp
public sealed class UseExclusiveLockAttribute : Attribute
```

The UseExclusiveLock attribute is used to mark transactional methods that should acquire exclusive locks even for read operations. This prevents frequent lock upgrade conflicts under high contention.

## Examples

```csharp
[UseExclusiveLock]
            [Transaction(TransactionOption.CreateOrJoin)]
            Task<uint> GetBalance();
```

## Constructors

- [UseExclusiveLockAttribute](/orleans/docs/api/csharp/microsoft.orleans.transactions/orleans.useexclusivelockattribute/constructors/constructor-49687ea1/)
