BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News EF Core: Unifying SQL and NoSQL Databases

EF Core: Unifying SQL and NoSQL Databases

This item in japanese

Bookmarks

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
Style

BT