dotnet / dotnet/efcore

Cosmos: API to materialize entities from raw JSON data

Open
#37,542 6 comments 0 reactions 0 assignees View on GitHub
area-cosmos customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

### What problem are you trying to solve?

When working with Azure Cosmos DB, you might interact with cosmos db directly (outside of EF) but still want to deserialize the document to an entity.
For example, when using the change feed processor:
```
var client = context.Database.GetCosmosClient();
var container = client.GetContainer(
context.Database.GetCosmosDatabaseId(),
context.Model.GetEntityTypes().Single().GetContainer());

var processor = container.GetChangeFeedProcessorBuilder("processor", async (IReadOnlyCollection changes, CancellationToken ctx) =>
{
foreach (var change in changes)
{
// Deserialize to entity?
}
}).WithInMemoryLeaseContainer().Build();
```

### Describe the solution you'd like

Some way to deserialize documents to entity types

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.