Sunday, April 5, 2020

Using MongoDB for your .Net applications - Data Access (Layer)

Hopefully you might have worked on MongoDB or probably not. Anyway, MongoDB can be downloaded https://www.mongodb.com/download-center/community here. It's the community version and free version. Install and run the server. It runs on localhost:27017.

If you want to know more about what is MongoDB, visit here https://www.mongodb.com/what-is-mongodb


When you download the server and install, you can easily do all the CRUD operations. for that you need to install the MongoDB nuget package. Those have the necessary dlls to perform database actions. following are the packages you need to install.


Once you have it, you can reference the namespaces.



So, you now you are ready to write your own codes to deal with MongoDB. For example, you can think of the following code.























This is how you can get this to use in your front end.





try to understand the basics here. documentation of MongoDB is here (https://developer.mongodb.com/learn?languages=C%23)

Next time, lets see how we can write our own Data Access Layer.

Until that, happy coding.

No comments:

Post a Comment