---
title: "Session: Storing Entities"
url: "https://docs.ravendb.net/6.2/client-api/session/storing-entities"
version: "6.2"
language: "csharp"
---

# Session: Storing Entities

> Client language: C#. Also available for [Java](https://docs.ravendb.net/6.2/client-api/session/storing-entities.java.md), [Python](https://docs.ravendb.net/6.2/client-api/session/storing-entities.python.md), [PHP](https://docs.ravendb.net/6.2/client-api/session/storing-entities.php.md), [Node.js](https://docs.ravendb.net/6.2/client-api/session/storing-entities.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

To store entities inside the **session** object, use one of the three `Store` methods.

## Syntax

First overload: Stores the entity in a session, then extracts the ID from the entity or generates a new one if it's not available.

```csharp
void Store(object entity);
```

Second overload: Stores the entity in a session with given ID.

```csharp
void Store(object entity, string id);
```

Third overload: Stores the entity in a session with given ID, forces concurrency check with given change vector.

```csharp
void Store(object entity, string changeVector, string id);
```

| Parameters | | |
| - | - | - |
| **entity** | `object` | Entity that will be stored |
| **changeVector** | `string` | Entity changeVector, used for concurrency checks (`null` to skip check) |
| **id** | `string` | Entity will be stored under this ID, (`null` to generate automatically) |

## Example

```csharp
// generate Id automatically
session.Store(new Employee
{
  FirstName = "John",
  LastName = "Doe"
});

// send all pending operations to server, in this case only `Put` operation
session.SaveChanges();
```

## See also

- [What is a Session and How Does it Work](https://docs.ravendb.net/6.2/client-api/session/what-is-a-session-and-how-does-it-work.md)
- [Opening a Session](https://docs.ravendb.net/6.2/client-api/session/opening-a-session.md)
- [Loading Entities](https://docs.ravendb.net/6.2/client-api/session/loading-entities.md)
- [Saving Changes](https://docs.ravendb.net/6.2/client-api/session/saving-changes.md)
- [Query Overview](https://docs.ravendb.net/6.2/client-api/session/querying/how-to-query.md)
- [Basics](https://docs.ravendb.net/6.2/indexes/querying/query-index.md)
- [What is a Document Store](https://docs.ravendb.net/6.2/client-api/what-is-a-document-store.md)
