How and why I built I built a C# class library on MongoDB

Published May 03, 2018

About me

I am Dakolo Diepreye Micah, a results-driven, customer-focused and analytical Software Engineer with 5+ years experience developing robust code for high-volume businesses.

Experienced in developing web applications and web services, cross-platform desktop application, SQL and NoSQL database analysis and design.

The problem I wanted to solve

Was building a robust WPF application using MongoDB as the database. Before now, was using relational databases like MSSQL and MySQL with either Entityframework or Nhibernate ORM. These ORMs were built using the unit of work pattern.

I wanted to have the same flexibility using MongoDB in my application and also support Transaction as it is in relational databases so I decided to build the MongoUnitOfWork library.

What is MongoUnitOfWork?

MongoUnitOfWork is an extensible library which implements the Unit of Work pattern on top of the Official MongoDB C# driver. It also supports multi-document transactions using two-phase commit as described in MongoDB documentation.

The project is hosted on github

Tech stack

Basically, MongoUnitOfWork library is built with Visual Studio IDE using the unit of work pattern. Support for Transaction was done using the Two Phase Commit protocol.

The process of building I built a C# class library on MongoDB

Before building the library, I needed a full understanding on MongoDB and its driver for C#. To achieve that, I took the MongoDB for .NET Developers (M101N) course in Mongo university.

Building the library, Firstly, I installed the community version of Visual Studio IDE.

Secondly, I downloaded the official MongoDB C# driver from nuget into my project

Lastly, I built the library, tested it and hosted it on nuget and github for use and improvement respectively.

Challenges I faced

The major challenge was taking the MongoDB for .NET Developers (M101N) course and keeping up with work.

Final thoughts and next steps

I am happy I built this library, I will continue to work on it. I intend to have the same in Java.

Discover and read more posts from Diepreye Dakolo
get started