5.2.0 (latest) 5.1.0 5.0.0 4.17.0 4.16.0 4.15.0 4.14.0 4.13.0 4.12.0 4.11.0 4.10.0 4.9.0 4.8.0 4.7.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.5.0 3.4.0 3.3.0 3.2.0

    public abstract class DatastoreClient

Reference documentation and code samples for the Google Cloud Datastore v1 API class DatastoreClient.

Datastore client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> DatastoreClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[DatastoreClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClientImpl)

## Namespace

[Google.Cloud.Datastore.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1)

## Assembly

Google.Cloud.Datastore.V1.dll

## Remarks

Each RPC normalizes the partition IDs of the keys in its input entities,
and always returns entities with keys with normalized partition IDs.
This applies to all keys and entities, including those in values, except keys
with both an empty path and an empty or unset partition ID. Normalization of
input keys sets the project ID (if not already set) to the project ID from
the request.

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the Datastore service, which is a host of "datastore.googleapis.com" and a port of
443.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default Datastore scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default Datastore scopes are:

- <https://www.googleapis.com/auth/cloud-platform>
- <https://www.googleapis.com/auth/datastore>

### GrpcClient

    public virtual Datastore.DatastoreClient GrpcClient { get; }

The underlying gRPC Datastore client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Datastorehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Datastore.DatastoreClient` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### AllocateIds(AllocateIdsRequest, CallSettings)

    public virtual AllocateIdsResponse AllocateIds(AllocateIdsRequest request, CallSettings callSettings = null)

Allocates IDs for the given keys, which is useful for referencing an entity
before it is inserted.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    AllocateIdsRequest request = new AllocateIdsRequest
    {
        Keys = { new Key(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    AllocateIdsResponse response = datastoreClient.AllocateIds(request);

### AllocateIds(string, IEnumerable\<Key\>, CallSettings)

    public virtual AllocateIdsResponse AllocateIds(string projectId, IEnumerable<Key> keys, CallSettings callSettings = null)

Allocates IDs for the given keys, which is useful for referencing an entity
before it is inserted.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. A list of keys with incomplete key paths for which to allocate IDs. No key may be reserved/read-only. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsResponse` | The RPC response. |

**Example**

    DatastoreClient client = DatastoreClient.Create();
    KeyFactory keyFactory = new KeyFactory(projectId, namespaceId, "message");
    AllocateIdsResponse response = client.AllocateIds(projectId,
        new[] { keyFactory.CreateIncompleteKey(), keyFactory.CreateIncompleteKey() }
    );
    Entity entity1 = new Entity { Key = response.Keys[0], ["text"] = "Text 1" };
    Entity entity2 = new Entity { Key = response.Keys[1], ["text"] = "Text 2" };

### AllocateIdsAsync(AllocateIdsRequest, CallSettings)

    public virtual Task<AllocateIdsResponse> AllocateIdsAsync(AllocateIdsRequest request, CallSettings callSettings = null)

Allocates IDs for the given keys, which is useful for referencing an entity
before it is inserted.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    AllocateIdsRequest request = new AllocateIdsRequest
    {
        Keys = { new Key(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    AllocateIdsResponse response = await datastoreClient.AllocateIdsAsync(request);

### AllocateIdsAsync(AllocateIdsRequest, CancellationToken)

    public virtual Task<AllocateIdsResponse> AllocateIdsAsync(AllocateIdsRequest request, CancellationToken cancellationToken)

Allocates IDs for the given keys, which is useful for referencing an entity
before it is inserted.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    AllocateIdsRequest request = new AllocateIdsRequest
    {
        Keys = { new Key(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    AllocateIdsResponse response = await datastoreClient.AllocateIdsAsync(request);

### AllocateIdsAsync(string, IEnumerable\<Key\>, CallSettings)

    public virtual Task<AllocateIdsResponse> AllocateIdsAsync(string projectId, IEnumerable<Key> keys, CallSettings callSettings = null)

Allocates IDs for the given keys, which is useful for referencing an entity
before it is inserted.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. A list of keys with incomplete key paths for which to allocate IDs. No key may be reserved/read-only. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    IEnumerable<Key> keys = new Key[] { new Key(), };
    // Make the request
    AllocateIdsResponse response = await datastoreClient.AllocateIdsAsync(projectId, keys);

### AllocateIdsAsync(string, IEnumerable\<Key\>, CancellationToken)

    public virtual Task<AllocateIdsResponse> AllocateIdsAsync(string projectId, IEnumerable<Key> keys, CancellationToken cancellationToken)

Allocates IDs for the given keys, which is useful for referencing an entity
before it is inserted.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. A list of keys with incomplete key paths for which to allocate IDs. No key may be reserved/read-only. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.AllocateIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    IEnumerable<Key> keys = new Key[] { new Key(), };
    // Make the request
    AllocateIdsResponse response = await datastoreClient.AllocateIdsAsync(projectId, keys);

### BeginTransaction(BeginTransactionRequest, CallSettings)

    public virtual BeginTransactionResponse BeginTransaction(BeginTransactionRequest request, CallSettings callSettings = null)

Begins a new transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    BeginTransactionRequest request = new BeginTransactionRequest
    {
        ProjectId = "",
        DatabaseId = "",
        TransactionOptions = new TransactionOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    BeginTransactionResponse response = datastoreClient.BeginTransaction(request);

### BeginTransaction(string, CallSettings)

    public virtual BeginTransactionResponse BeginTransaction(string projectId, CallSettings callSettings = null)

Begins a new transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    string projectId = "";
    // Make the request
    BeginTransactionResponse response = datastoreClient.BeginTransaction(projectId);

### BeginTransactionAsync(BeginTransactionRequest, CallSettings)

    public virtual Task<BeginTransactionResponse> BeginTransactionAsync(BeginTransactionRequest request, CallSettings callSettings = null)

Begins a new transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    BeginTransactionRequest request = new BeginTransactionRequest
    {
        ProjectId = "",
        DatabaseId = "",
        TransactionOptions = new TransactionOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    BeginTransactionResponse response = await datastoreClient.BeginTransactionAsync(request);

### BeginTransactionAsync(BeginTransactionRequest, CancellationToken)

    public virtual Task<BeginTransactionResponse> BeginTransactionAsync(BeginTransactionRequest request, CancellationToken cancellationToken)

Begins a new transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    BeginTransactionRequest request = new BeginTransactionRequest
    {
        ProjectId = "",
        DatabaseId = "",
        TransactionOptions = new TransactionOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    BeginTransactionResponse response = await datastoreClient.BeginTransactionAsync(request);

### BeginTransactionAsync(string, CallSettings)

    public virtual Task<BeginTransactionResponse> BeginTransactionAsync(string projectId, CallSettings callSettings = null)

Begins a new transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    // Make the request
    BeginTransactionResponse response = await datastoreClient.BeginTransactionAsync(projectId);

### BeginTransactionAsync(string, CancellationToken)

    public virtual Task<BeginTransactionResponse> BeginTransactionAsync(string projectId, CancellationToken cancellationToken)

Begins a new transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.BeginTransactionResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    // Make the request
    BeginTransactionResponse response = await datastoreClient.BeginTransactionAsync(projectId);

### Commit(CommitRequest, CallSettings)

    public virtual CommitResponse Commit(CommitRequest request, CallSettings callSettings = null)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    CommitRequest request = new CommitRequest
    {
        Transaction = ByteString.Empty,
        Mode = CommitRequest.Types.Mode.Unspecified,
        Mutations = { new Mutation(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    CommitResponse response = datastoreClient.Commit(request);

### Commit(string, Mode, ByteString, IEnumerable\<Mutation\>, CallSettings)

    public virtual CommitResponse Commit(string projectId, CommitRequest.Types.Mode mode, ByteString transaction, IEnumerable<Mutation> mutations, CallSettings callSettings = null)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `mode` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Types.Mode` The type of commit to perform. Defaults to `TRANSACTIONAL`. |
| `transaction` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` The identifier of the transaction associated with the commit. A transaction identifier is returned by a call to \[Datastore.BeginTransaction\]\[google.datastore.v1.Datastore.BeginTransaction\]. |
| `mutations` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Mutation` The mutations to perform. When mode is `TRANSACTIONAL`, mutations affecting a single entity are applied in order. The following sequences of mutations affecting a single entity are not permitted in a single `Commit` request: - `insert` followed by `insert` - `update` followed by `insert` - `upsert` followed by `insert` - `delete` followed by `update` When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single entity. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    string projectId = "";
    CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified;
    ByteString transaction = ByteString.Empty;
    IEnumerable<Mutation> mutations = new Mutation[] { new Mutation(), };
    // Make the request
    CommitResponse response = datastoreClient.Commit(projectId, mode, transaction, mutations);

### Commit(string, Mode, IEnumerable\<Mutation\>, CallSettings)

    public virtual CommitResponse Commit(string projectId, CommitRequest.Types.Mode mode, IEnumerable<Mutation> mutations, CallSettings callSettings = null)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `mode` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Types.Mode` The type of commit to perform. Defaults to `TRANSACTIONAL`. |
| `mutations` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Mutation` The mutations to perform. When mode is `TRANSACTIONAL`, mutations affecting a single entity are applied in order. The following sequences of mutations affecting a single entity are not permitted in a single `Commit` request: - `insert` followed by `insert` - `update` followed by `insert` - `upsert` followed by `insert` - `delete` followed by `update` When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single entity. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    string projectId = "";
    CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified;
    IEnumerable<Mutation> mutations = new Mutation[] { new Mutation(), };
    // Make the request
    CommitResponse response = datastoreClient.Commit(projectId, mode, mutations);

### CommitAsync(CommitRequest, CallSettings)

    public virtual Task<CommitResponse> CommitAsync(CommitRequest request, CallSettings callSettings = null)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    CommitRequest request = new CommitRequest
    {
        Transaction = ByteString.Empty,
        Mode = CommitRequest.Types.Mode.Unspecified,
        Mutations = { new Mutation(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    CommitResponse response = await datastoreClient.CommitAsync(request);

### CommitAsync(CommitRequest, CancellationToken)

    public virtual Task<CommitResponse> CommitAsync(CommitRequest request, CancellationToken cancellationToken)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    CommitRequest request = new CommitRequest
    {
        Transaction = ByteString.Empty,
        Mode = CommitRequest.Types.Mode.Unspecified,
        Mutations = { new Mutation(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    CommitResponse response = await datastoreClient.CommitAsync(request);

### CommitAsync(string, Mode, ByteString, IEnumerable\<Mutation\>, CallSettings)

    public virtual Task<CommitResponse> CommitAsync(string projectId, CommitRequest.Types.Mode mode, ByteString transaction, IEnumerable<Mutation> mutations, CallSettings callSettings = null)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `mode` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Types.Mode` The type of commit to perform. Defaults to `TRANSACTIONAL`. |
| `transaction` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` The identifier of the transaction associated with the commit. A transaction identifier is returned by a call to \[Datastore.BeginTransaction\]\[google.datastore.v1.Datastore.BeginTransaction\]. |
| `mutations` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Mutation` The mutations to perform. When mode is `TRANSACTIONAL`, mutations affecting a single entity are applied in order. The following sequences of mutations affecting a single entity are not permitted in a single `Commit` request: - `insert` followed by `insert` - `update` followed by `insert` - `upsert` followed by `insert` - `delete` followed by `update` When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single entity. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified;
    ByteString transaction = ByteString.Empty;
    IEnumerable<Mutation> mutations = new Mutation[] { new Mutation(), };
    // Make the request
    CommitResponse response = await datastoreClient.CommitAsync(projectId, mode, transaction, mutations);

### CommitAsync(string, Mode, ByteString, IEnumerable\<Mutation\>, CancellationToken)

    public virtual Task<CommitResponse> CommitAsync(string projectId, CommitRequest.Types.Mode mode, ByteString transaction, IEnumerable<Mutation> mutations, CancellationToken cancellationToken)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `mode` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Types.Mode` The type of commit to perform. Defaults to `TRANSACTIONAL`. |
| `transaction` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` The identifier of the transaction associated with the commit. A transaction identifier is returned by a call to \[Datastore.BeginTransaction\]\[google.datastore.v1.Datastore.BeginTransaction\]. |
| `mutations` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Mutation` The mutations to perform. When mode is `TRANSACTIONAL`, mutations affecting a single entity are applied in order. The following sequences of mutations affecting a single entity are not permitted in a single `Commit` request: - `insert` followed by `insert` - `update` followed by `insert` - `upsert` followed by `insert` - `delete` followed by `update` When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single entity. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified;
    ByteString transaction = ByteString.Empty;
    IEnumerable<Mutation> mutations = new Mutation[] { new Mutation(), };
    // Make the request
    CommitResponse response = await datastoreClient.CommitAsync(projectId, mode, transaction, mutations);

### CommitAsync(string, Mode, IEnumerable\<Mutation\>, CallSettings)

    public virtual Task<CommitResponse> CommitAsync(string projectId, CommitRequest.Types.Mode mode, IEnumerable<Mutation> mutations, CallSettings callSettings = null)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `mode` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Types.Mode` The type of commit to perform. Defaults to `TRANSACTIONAL`. |
| `mutations` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Mutation` The mutations to perform. When mode is `TRANSACTIONAL`, mutations affecting a single entity are applied in order. The following sequences of mutations affecting a single entity are not permitted in a single `Commit` request: - `insert` followed by `insert` - `update` followed by `insert` - `upsert` followed by `insert` - `delete` followed by `update` When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single entity. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified;
    IEnumerable<Mutation> mutations = new Mutation[] { new Mutation(), };
    // Make the request
    CommitResponse response = await datastoreClient.CommitAsync(projectId, mode, mutations);

### CommitAsync(string, Mode, IEnumerable\<Mutation\>, CancellationToken)

    public virtual Task<CommitResponse> CommitAsync(string projectId, CommitRequest.Types.Mode mode, IEnumerable<Mutation> mutations, CancellationToken cancellationToken)

Commits a transaction, optionally creating, deleting or modifying some
entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `mode` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest.Types.Mode` The type of commit to perform. Defaults to `TRANSACTIONAL`. |
| `mutations` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Mutation` The mutations to perform. When mode is `TRANSACTIONAL`, mutations affecting a single entity are applied in order. The following sequences of mutations affecting a single entity are not permitted in a single `Commit` request: - `insert` followed by `insert` - `update` followed by `insert` - `upsert` followed by `insert` - `delete` followed by `update` When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single entity. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified;
    IEnumerable<Mutation> mutations = new Mutation[] { new Mutation(), };
    // Make the request
    CommitResponse response = await datastoreClient.CommitAsync(projectId, mode, mutations);

### Create()

    public static DatastoreClient Create()

Synchronously creates a [DatastoreClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient) using the default credentials, endpoint and settings.
To specify custom credentials or other settings, use [DatastoreClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient` | The created [DatastoreClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient). |

### CreateAsync(CancellationToken)

    public static Task<DatastoreClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [DatastoreClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient) using the default credentials, endpoint and settings.
To specify custom credentials or other settings, use [DatastoreClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient` | The task representing the created [DatastoreClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient). |

### Lookup(LookupRequest, CallSettings)

    public virtual LookupResponse Lookup(LookupRequest request, CallSettings callSettings = null)

Looks up entities by key.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    LookupRequest request = new LookupRequest
    {
        ReadOptions = new ReadOptions(),
        Keys = { new Key(), },
        PropertyMask = new PropertyMask(),
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    LookupResponse response = datastoreClient.Lookup(request);

### Lookup(string, ReadOptions, IEnumerable\<Key\>, CallSettings)

    public virtual LookupResponse Lookup(string projectId, ReadOptions readOptions, IEnumerable<Key> keys, CallSettings callSettings = null)

Looks up entities by key.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `readOptions` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReadOptions` The options for this lookup request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. Keys of entities to look up. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupResponse` | The RPC response. |

**Example**

    KeyFactory keyFactory = new KeyFactory(projectId, namespaceId, "book");
    Key key1 = keyFactory.CreateKey("pride_and_prejudice");
    Key key2 = keyFactory.CreateKey("not_present");

    DatastoreClient client = DatastoreClient.Create();
    LookupResponse response = client.Lookup(
        projectId,
        new ReadOptions { ReadConsistency = ReadConsistency.Strong },
        new[] { key1, key2 });
    Console.WriteLine($"Found: {response.Found.Count}");
    Console.WriteLine($"Deferred: {response.Deferred.Count}");
    Console.WriteLine($"Missing: {response.Missing.Count}");

### LookupAsync(LookupRequest, CallSettings)

    public virtual Task<LookupResponse> LookupAsync(LookupRequest request, CallSettings callSettings = null)

Looks up entities by key.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    LookupRequest request = new LookupRequest
    {
        ReadOptions = new ReadOptions(),
        Keys = { new Key(), },
        PropertyMask = new PropertyMask(),
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    LookupResponse response = await datastoreClient.LookupAsync(request);

### LookupAsync(LookupRequest, CancellationToken)

    public virtual Task<LookupResponse> LookupAsync(LookupRequest request, CancellationToken cancellationToken)

Looks up entities by key.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    LookupRequest request = new LookupRequest
    {
        ReadOptions = new ReadOptions(),
        Keys = { new Key(), },
        PropertyMask = new PropertyMask(),
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    LookupResponse response = await datastoreClient.LookupAsync(request);

### LookupAsync(string, ReadOptions, IEnumerable\<Key\>, CallSettings)

    public virtual Task<LookupResponse> LookupAsync(string projectId, ReadOptions readOptions, IEnumerable<Key> keys, CallSettings callSettings = null)

Looks up entities by key.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `readOptions` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReadOptions` The options for this lookup request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. Keys of entities to look up. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    ReadOptions readOptions = new ReadOptions();
    IEnumerable<Key> keys = new Key[] { new Key(), };
    // Make the request
    LookupResponse response = await datastoreClient.LookupAsync(projectId, readOptions, keys);

### LookupAsync(string, ReadOptions, IEnumerable\<Key\>, CancellationToken)

    public virtual Task<LookupResponse> LookupAsync(string projectId, ReadOptions readOptions, IEnumerable<Key> keys, CancellationToken cancellationToken)

Looks up entities by key.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `readOptions` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReadOptions` The options for this lookup request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. Keys of entities to look up. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.LookupResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    ReadOptions readOptions = new ReadOptions();
    IEnumerable<Key> keys = new Key[] { new Key(), };
    // Make the request
    LookupResponse response = await datastoreClient.LookupAsync(projectId, readOptions, keys);

### ReserveIds(ReserveIdsRequest, CallSettings)

    public virtual ReserveIdsResponse ReserveIds(ReserveIdsRequest request, CallSettings callSettings = null)

Prevents the supplied keys' IDs from being auto-allocated by Cloud
Datastore.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    ReserveIdsRequest request = new ReserveIdsRequest
    {
        Keys = { new Key(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    ReserveIdsResponse response = datastoreClient.ReserveIds(request);

### ReserveIds(string, IEnumerable\<Key\>, CallSettings)

    public virtual ReserveIdsResponse ReserveIds(string projectId, IEnumerable<Key> keys, CallSettings callSettings = null)

Prevents the supplied keys' IDs from being auto-allocated by Cloud
Datastore.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. A list of keys with complete key paths whose numeric IDs should not be auto-allocated. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    string projectId = "";
    IEnumerable<Key> keys = new Key[] { new Key(), };
    // Make the request
    ReserveIdsResponse response = datastoreClient.ReserveIds(projectId, keys);

### ReserveIdsAsync(ReserveIdsRequest, CallSettings)

    public virtual Task<ReserveIdsResponse> ReserveIdsAsync(ReserveIdsRequest request, CallSettings callSettings = null)

Prevents the supplied keys' IDs from being auto-allocated by Cloud
Datastore.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    ReserveIdsRequest request = new ReserveIdsRequest
    {
        Keys = { new Key(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    ReserveIdsResponse response = await datastoreClient.ReserveIdsAsync(request);

### ReserveIdsAsync(ReserveIdsRequest, CancellationToken)

    public virtual Task<ReserveIdsResponse> ReserveIdsAsync(ReserveIdsRequest request, CancellationToken cancellationToken)

Prevents the supplied keys' IDs from being auto-allocated by Cloud
Datastore.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    ReserveIdsRequest request = new ReserveIdsRequest
    {
        Keys = { new Key(), },
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    ReserveIdsResponse response = await datastoreClient.ReserveIdsAsync(request);

### ReserveIdsAsync(string, IEnumerable\<Key\>, CallSettings)

    public virtual Task<ReserveIdsResponse> ReserveIdsAsync(string projectId, IEnumerable<Key> keys, CallSettings callSettings = null)

Prevents the supplied keys' IDs from being auto-allocated by Cloud
Datastore.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. A list of keys with complete key paths whose numeric IDs should not be auto-allocated. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    IEnumerable<Key> keys = new Key[] { new Key(), };
    // Make the request
    ReserveIdsResponse response = await datastoreClient.ReserveIdsAsync(projectId, keys);

### ReserveIdsAsync(string, IEnumerable\<Key\>, CancellationToken)

    public virtual Task<ReserveIdsResponse> ReserveIdsAsync(string projectId, IEnumerable<Key> keys, CancellationToken cancellationToken)

Prevents the supplied keys' IDs from being auto-allocated by Cloud
Datastore.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `keys` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Key` Required. A list of keys with complete key paths whose numeric IDs should not be auto-allocated. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.ReserveIdsResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    IEnumerable<Key> keys = new Key[] { new Key(), };
    // Make the request
    ReserveIdsResponse response = await datastoreClient.ReserveIdsAsync(projectId, keys);

### Rollback(RollbackRequest, CallSettings)

    public virtual RollbackResponse Rollback(RollbackRequest request, CallSettings callSettings = null)

Rolls back a transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    RollbackRequest request = new RollbackRequest
    {
        Transaction = ByteString.Empty,
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RollbackResponse response = datastoreClient.Rollback(request);

### Rollback(string, ByteString, CallSettings)

    public virtual RollbackResponse Rollback(string projectId, ByteString transaction, CallSettings callSettings = null)

Rolls back a transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `transaction` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` Required. The transaction identifier, returned by a call to \[Datastore.BeginTransaction\]\[google.datastore.v1.Datastore.BeginTransaction\]. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    string projectId = "";
    ByteString transaction = ByteString.Empty;
    // Make the request
    RollbackResponse response = datastoreClient.Rollback(projectId, transaction);

### RollbackAsync(RollbackRequest, CallSettings)

    public virtual Task<RollbackResponse> RollbackAsync(RollbackRequest request, CallSettings callSettings = null)

Rolls back a transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    RollbackRequest request = new RollbackRequest
    {
        Transaction = ByteString.Empty,
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RollbackResponse response = await datastoreClient.RollbackAsync(request);

### RollbackAsync(RollbackRequest, CancellationToken)

    public virtual Task<RollbackResponse> RollbackAsync(RollbackRequest request, CancellationToken cancellationToken)

Rolls back a transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    RollbackRequest request = new RollbackRequest
    {
        Transaction = ByteString.Empty,
        ProjectId = "",
        DatabaseId = "",
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RollbackResponse response = await datastoreClient.RollbackAsync(request);

### RollbackAsync(string, ByteString, CallSettings)

    public virtual Task<RollbackResponse> RollbackAsync(string projectId, ByteString transaction, CallSettings callSettings = null)

Rolls back a transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `transaction` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` Required. The transaction identifier, returned by a call to \[Datastore.BeginTransaction\]\[google.datastore.v1.Datastore.BeginTransaction\]. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    ByteString transaction = ByteString.Empty;
    // Make the request
    RollbackResponse response = await datastoreClient.RollbackAsync(projectId, transaction);

### RollbackAsync(string, ByteString, CancellationToken)

    public virtual Task<RollbackResponse> RollbackAsync(string projectId, ByteString transaction, CancellationToken cancellationToken)

Rolls back a transaction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The ID of the project against which to make the request. |
| `transaction` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` Required. The transaction identifier, returned by a call to \[Datastore.BeginTransaction\]\[google.datastore.v1.Datastore.BeginTransaction\]. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RollbackResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    string projectId = "";
    ByteString transaction = ByteString.Empty;
    // Make the request
    RollbackResponse response = await datastoreClient.RollbackAsync(projectId, transaction);

### RunAggregationQuery(RunAggregationQueryRequest, CallSettings)

    public virtual RunAggregationQueryResponse RunAggregationQuery(RunAggregationQueryRequest request, CallSettings callSettings = null)

Runs an aggregation query.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunAggregationQueryRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunAggregationQueryResponse` | The RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = DatastoreClient.Create();
    // Initialize request argument(s)
    RunAggregationQueryRequest request = new RunAggregationQueryRequest
    {
        ReadOptions = new ReadOptions(),
        PartitionId = new PartitionId(),
        AggregationQuery = new AggregationQuery(),
        ProjectId = "",
        DatabaseId = "",
        ExplainOptions = new ExplainOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RunAggregationQueryResponse response = datastoreClient.RunAggregationQuery(request);

### RunAggregationQueryAsync(RunAggregationQueryRequest, CallSettings)

    public virtual Task<RunAggregationQueryResponse> RunAggregationQueryAsync(RunAggregationQueryRequest request, CallSettings callSettings = null)

Runs an aggregation query.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunAggregationQueryRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunAggregationQueryResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    RunAggregationQueryRequest request = new RunAggregationQueryRequest
    {
        ReadOptions = new ReadOptions(),
        PartitionId = new PartitionId(),
        AggregationQuery = new AggregationQuery(),
        ProjectId = "",
        DatabaseId = "",
        ExplainOptions = new ExplainOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RunAggregationQueryResponse response = await datastoreClient.RunAggregationQueryAsync(request);

### RunAggregationQueryAsync(RunAggregationQueryRequest, CancellationToken)

    public virtual Task<RunAggregationQueryResponse> RunAggregationQueryAsync(RunAggregationQueryRequest request, CancellationToken cancellationToken)

Runs an aggregation query.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunAggregationQueryRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunAggregationQueryResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    RunAggregationQueryRequest request = new RunAggregationQueryRequest
    {
        ReadOptions = new ReadOptions(),
        PartitionId = new PartitionId(),
        AggregationQuery = new AggregationQuery(),
        ProjectId = "",
        DatabaseId = "",
        ExplainOptions = new ExplainOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RunAggregationQueryResponse response = await datastoreClient.RunAggregationQueryAsync(request);

### RunQuery(RunQueryRequest, CallSettings)

    public virtual RunQueryResponse RunQuery(RunQueryRequest request, CallSettings callSettings = null)

Queries for entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunQueryRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunQueryResponse` | The RPC response. |

**Example**

    DatastoreClient client = DatastoreClient.Create();

    RunQueryRequest request = new RunQueryRequest
    {
        ProjectId = projectId,
        PartitionId = partitionId,
        ReadOptions = new ReadOptions { ReadConsistency = ReadConsistency.Eventual },
    };
    // Structured query
    request.Query = new Query("book")
    {
        Filter = Filter.Equal("author", "Jane Austen")
    };
    RunQueryResponse response = client.RunQuery(request);
    foreach (EntityResult result in response.Batch.EntityResults)
    {
        Console.WriteLine(result.Entity);
    }

    // Equivalent GQL query
    request.GqlQuery = new GqlQuery
    {
        QueryString = "SELECT * FROM book WHERE author = @author",
        NamedBindings = { { "author", "Jane Austen" } },
    };
    foreach (EntityResult result in response.Batch.EntityResults)
    {
        Console.WriteLine(result.Entity);
    }

### RunQueryAsync(RunQueryRequest, CallSettings)

    public virtual Task<RunQueryResponse> RunQueryAsync(RunQueryRequest request, CallSettings callSettings = null)

Queries for entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunQueryRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunQueryResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    RunQueryRequest request = new RunQueryRequest
    {
        ReadOptions = new ReadOptions(),
        PartitionId = new PartitionId(),
        Query = new Query(),
        ProjectId = "",
        DatabaseId = "",
        PropertyMask = new PropertyMask(),
        ExplainOptions = new ExplainOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RunQueryResponse response = await datastoreClient.RunQueryAsync(request);

### RunQueryAsync(RunQueryRequest, CancellationToken)

    public virtual Task<RunQueryResponse> RunQueryAsync(RunQueryRequest request, CancellationToken cancellationToken)

Queries for entities.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunQueryRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.RunQueryResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    DatastoreClient datastoreClient = await DatastoreClient.CreateAsync();
    // Initialize request argument(s)
    RunQueryRequest request = new RunQueryRequest
    {
        ReadOptions = new ReadOptions(),
        PartitionId = new PartitionId(),
        Query = new Query(),
        ProjectId = "",
        DatabaseId = "",
        PropertyMask = new PropertyMask(),
        ExplainOptions = new ExplainOptions(),
        RequestOptions = new RequestOptions(),
    };
    // Make the request
    RunQueryResponse response = await datastoreClient.RunQueryAsync(request);

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient#Google_Cloud_Datastore_V1_DatastoreClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient#Google_Cloud_Datastore_V1_DatastoreClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient#Google_Cloud_Datastore_V1_DatastoreClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreClient#Google_Cloud_Datastore_V1_DatastoreClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.