Class Entity (3.5.0)

public sealed class Entity : IMessage<Entity>, IEquatable<Entity>, IDeepCloneable<Entity>, IBufferMessage, IMessage

A Datastore data object.

An entity is limited to 1 megabyte when stored. That roughly corresponds to a limit of 1 megabyte for the serialized form of this message.

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
NameDescription
otherEntity

Properties

Item[String]

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

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

Parameter
NameDescription
nameString

Property name to access. The name itself must not be null.

Property Value
TypeDescription
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
TypeDescription
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 name must not contain more than 500 characters. The name cannot be &quot;&quot;.

Property Value
TypeDescription
MapField<String, Value>

Methods

ToDelete()

public Mutation ToDelete()

Creates a mutation representating a delete of this entity, via its Key property.

Returns
TypeDescription
Mutation
Exceptions
TypeDescription
InvalidOperationException

The entity does not have a key.

ToInsert()

public Mutation ToInsert()

Creates a mutation representating an insert of this entity.

Returns
TypeDescription
Mutation
Exceptions
TypeDescription
InvalidOperationException

The entity does not have a key.

ToUpdate()

public Mutation ToUpdate()

Creates a mutation representating an update of this entity.

Returns
TypeDescription
Mutation
Exceptions
TypeDescription
InvalidOperationException

The entity does not have a key.

ToUpsert()

public Mutation ToUpsert()

Creates a mutation representating an upsert of this entity.

Returns
TypeDescription
Mutation
Exceptions
TypeDescription
InvalidOperationException

The entity does not have a key.