DocumentDB is a general-purpose database based on NoSQL purposes and features. We can better understand how it works and how it can be used by recreating the classic CRUD application in ASP.NET MVC. We can add a new web project, called
WebFrontEnd, of type ASP.NET Web Application to the Visual Studio 2015 solutions. We can choose the .NET 4.6 MVC template. Visual Studio will create the entire web project to which we need to add all the references already added to the
SqlToDocumentDb project previously described in this chapter.
ASP.NET MVC is a model-based framework, where the models are C# classes. We can start using DocumentDB as the database backend for the classic CRUD approach. Before starting, in the
Web.Config file, add to the project an empty controller named
ProductsController. The first thing to add is the
DocumentClient accessor for DocumentDB (it is the same as in the previous project):
private DocumentClient _client; ...