BT

Ready for InfoQ 3.0? Try the new design and let us know what you think!

EF Core: Unifying SQL and NoSQL Databases

| by Jonathan Allen Follow 655 Followers on Mar 02, 2018. Estimated reading time: 1 minute |

One of the original goals of EF Core was to develop a model wherein both SQL and NoSQL style databases could be used with little or no change to the code. Microsoft is taking the first steps towards that goal with an experimental EF provider for Azure Cosmos DB. According to the EF 2.1 roadmap.

Cosmos DB provider preview: We have been developing an EF Core provider for the DocumentDB API in Cosmos DB. This is the first document database provider we have produced, and the learnings from this exercise are going to inform improvements in the design of the subsequent release after 2.1. The current plan is to publish an early preview of the Cosmos DB provider in the 2.1 timeframe.

Azure Cosmos DB is the "multi-modal" NoSQL database that was reported on at InfoQ previously. It can act as a document database similar to the deprecated Azure DocumentDB or using the MongoDB API. It can also act as a simple key-value table, a graph database (based on Gremlin), or a time series database using the Cassandra API.

The first new API for EF Core's NoSQL support is UseDocumentDB, which takes a URL, key, and database name. This is used in lieu of a connection string.

Next up is dbContext.Database.EnsureCreated. Deleting a database is just as easy using dbContext.Database.EnsureDeleted. Aside from that, everything looks just as it would for a normal EF-based application storing data in SQL Server.

In the Channel 9 demonstration, it didn't actually store the data in a typical NoSQL, hierarchical document. Instead the Blog and Post objects were stored in separate collections much like a normalized database. Documentation hasn't been released yet, so it is too early to say how this behavior will be configured.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT