CURD Data Manipulation is nothing but a Create Update Read and Delete. Normally those operation will be happened on the Relational Databases like SQL, Oracle and MySQL using the DDL and DML queries.
But in this chapter I am going to explain how we can achieve the CURD operations in Mongo DB in Asp.net.
Comparatively No Sql databases are more scalable and more efficient with relational database. Relational database will require schema for each creation of records but it doesn’t require any schema. Schema will be defined in runtime based on the data stored in the data collections.
Large size of structured as well as unstructured data can be stored in NO SQL databases.
Easy to use the object oriented programing to store and retrieve the data from No Sql database.
Before creating the application we need to set up Mongo Database. Free mongo database setup are available in online, you can download and set it up in your local system or in server.
Create Asp.Net Web Form application.
Add the MongoDB assemblies from NUGet Packages.
Once you installed the Packages the respective DLLs will be added in your project reference.
I have created the Utility class for CURD operation as a separate class. Code snippets as bellow.
Here is the BsonDocument used for CURD operation.
Create a new custom class called Customer to do the CURD operation for the above document.
Create the new class in your project and copy paste the below code.
Next step is to create the Web form design the Grid view with Edit template to do the CURD operation.
Create new web Form and copy paste the below code.
I have implemented different events in Gridview for CURD operations
Create new record with BsonDocument
For Update the record we need to invoke two events both RowEditing and RowUpdating
NO SQL database is the most power full database architecture, which is more efficient and scalable database than our old relational database.
One of major advantage over relational database is, it is more flexible with object oriented programing
Next is no need for schema like relational database, we can creation N number of collections, in each collections we can store the different schema of data.
In this Article I have explained the Mongo database integration with Asp.net. Data manipulation is happening through Grid view with different row events. I hope this article will be useful and easy understandable.
Thanks for reading this article.
About the Author
James warner is a veteran of the Asp.net Development space, having worked as a Java developer in outsourcing/consulting firm NexSoftSys for the last 10 years. His major contributions include a collection of web solutions for Java, Python, Asp.Net, and mobile apps, among others.
We found a reliable and efficient partner in NexSoftSys, ready to support our strategy of offshore software development. NexSoftSys has particularly impressed by the speed of response to any request for the development of software applications and for their maintenance.
We did hire full time Java developers from NexSoftSys, to help us to improve a time to market of a product. The software platform is based on Java & Extjs, and they are delivering the software on time and with success. We strongly recommend NexSoftSys as Reliable Development partner.
Powerful solutions are given by NexSoftSys dedicated developers for my projects. They suggest solutions as per current market trend. Other than this, the team is always ready for any type of changes or update. That is the main reason that I would like to give my next project to them.
Copyright © 2016 - NexSoftSys All rights reserved