5.4.0 (latest) 5.3.0 5.2.0 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 sealed class Entity : IMessage<Entity>, IEquatable<Entity>, IDeepCloneable<Entity>, IBufferMessage, IMessage

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

A Datastore data object.

Must not exceed 1 MiB - 4 bytes.

## Inheritance

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

## Implements

[IMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.md.txt)[Entity](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Entity.md.txt), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Entity](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Entity.md.txt), [IDeepCloneable](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.md.txt)[Entity](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Entity.md.txt), [IBufferMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.md.txt), [IMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.md.txt)

## 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.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

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

## Assembly

Google.Cloud.Datastore.V1.dll

## Constructors

### Entity()

    public Entity()

### Entity(Entity)

    public Entity(Entity other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `Entity` |

## Properties

### this\[string\]

    public Value this[string name] { get; set; }

Indexer presenting a null-friendly view of the entity properties.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `string` Property name to access. The name itself must not be null. |

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `Value` | The property value associated with the key. |

**Remarks**
When using the getter of this indexer, if the key is not present in
this entity's set of properties, `null` is returned.


When using the setter of the indexer, setting a null value removes the
property if it is present. To explicitly set a null value, use [ForNull()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Value.md.txt#Google_Cloud_Datastore_V1_Value_ForNull).

### Key

    public Key Key { get; set; }

The entity's key.

An entity must have a key, unless otherwise documented (for example,
an entity in `Value.entity_value` may have no key).
An entity's kind is its key path's last element's kind,
or null if it has no key.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `Key` |   |

### Properties

    public MapField<string, Value> Properties { get; }

The entity's properties.
The map's keys are property names.
A property name matching regex `__.*__` is reserved.
A reserved property name is forbidden in certain documented contexts.
The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot
be empty.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `MapFieldstringValue` |   |

## Methods

### ToDelete()

    public Mutation ToDelete()

Creates a mutation representating a delete of this entity, via its [Key](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.Entity.md.txt#Google_Cloud_Datastore_V1_Entity_Key) property.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Mutation` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `InvalidOperationException` | The entity does not have a key. |

### ToInsert()

    public Mutation ToInsert()

Creates a mutation representating an insert of this entity.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Mutation` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `InvalidOperationException` | The entity does not have a key. |

### ToUpdate()

    public Mutation ToUpdate()

Creates a mutation representating an update of this entity.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Mutation` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `InvalidOperationException` | The entity does not have a key. |

### ToUpsert()

    public Mutation ToUpsert()

Creates a mutation representating an upsert of this entity.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Mutation` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `InvalidOperationException` | The entity does not have a key. |