Google Cloud Datastore v1 API - Class Entity (4.13.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 > Entity

Namespace

Google.Cloud.Datastore.V1

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().

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 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.