Error while using CosmosDB provider for Entity Framework Core with Azure Tables

.net-core azure azure-cosmosdb c# entity-framework-core

Question

I'm trying to do a simple CRUD application with EF Core and Azure Table (from Azure Storage Account).

I'm passing name of the storage account as database name (The docs aren't exactly clear on that)

services.AddDbContext<HomioDbContext>(options =>    
                options.UseCosmos(
                    "https://homiostorage.table.core.windows.net/",
                    "{Account Key}",
                    databaseName: "{name of storage account}"));

Doing any db operation throws following error (The value for one of the HTTP headers is not in the correct format)

CosmosException;StatusCode=BadRequest;SubStatusCode=0;ActivityId=00000000-0000-0000-0000-000000000000;RequestCharge=0;Message=Response status code does not indicate success: 400 Substatus: 0 Reason: (<?xml version="1.0" encoding="utf-8" standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">  <code>InvalidHeaderValue</code>  <message xml:lang="en-US">The value for one of the HTTP headers is not in the correct format.RequestId:cdef27c9-3002-0084-60dd-d9b8b0000000Time:2020-02-02T15:29:31.9748413Z</message></error>, Request URI: /, RequestStats: , SDK: Windows/10.0.18363 cosmos-netstandard-sdk/3.3.0).;Diagnostics

Been stuck at it for a while now... Could really use some help!

1
0
2/2/2020 3:32:44 PM

Accepted Answer

As per the documentation here, EF Core Provider for Cosmos DB only supports SQL API only (at least as of writing this answer) and you are using it against Table Storage. That's the reason you're getting this error.

3
2/2/2020 4:08:11 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow