E401 Cosmos: API to materiailze entities from raw JSON data · Issue #37542 · dotnet/efcore · GitHub
[go: up one dir, main page]

Skip to content

Cosmos: API to materiailze entities from raw JSON data #37542

@JoasE

Description

@JoasE

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0