MongODM

đź“– Information

An ODM (Object-Document-Mapper) for MongoDB

Map your domain models on documents for MongoDB, and use a complete and simple CRUD system with them. MongoDB's powerful LINQ query system is available for use, and you can simply save all changes made on models to the database.

Use the official drivers for MongoDB

Always updated with the official MongoDB drivers, which are the basis of the library's functioning. Every new MongoDB Server or Atlas versions will be always supported.

Natively on .Net

Libraries are compiled with the latest standards of .Net Core and .Net Standard, without the use of wrappers on external components.

🚀 Features

Natively integrated with Asp.Net Core

Easily add and configure MongODM through extension methods, integrated with the native IoC system offered by Asp.Net Core.

Oriented to testability and Dependency Injection

All components are defined with injectable interfaces, and this make them very versatile for configure tests using mockups, or use them with any Dependency Injection systems.

Natively configured to perform asynchronous tasks

Database maintenance operations are performed asynchronously. Hangfire is natively supported (Hangfire – Background jobs and workers for .NET and .NET Core), but other executors can freely configured without restrictions.

Map relationships between entities

Manage documents on MongoDB by mapping relationships between entities, also on different documents. Then optimize the denormalized documents for the information actually used with your application, minimizing disk accesses. The indexes on relations between documents are managed automatically.

Lazy loading

Load only information useful for your application, denormalizing the saved documents, and if information not previously loaded should be used, access it transparently from the model using a lazy loading system invisible to the application.

Divide data into database context

Each application domain should be able to access its own data context, and this can be easily achieved by using different database contexts. Then declare database contexts completely independent of each other, and easily access them from your application logic.

Use different repositories for different types of data

Each model type needs its own type of repository, and each repository is managed on a different collection of MongoDB. Keep your data well organized and available using different repositories.

Customizable indexes

Create and use your own customized indexes for each repository, taking advantage of MongoDB's configurability power. Optimize them to reduce the workload of searching on disk.

Migrations between document schemes

Take advantage of MongoDB's schemaless architecture to write constantly updated documents, minimizing the necessary migrations on databases. Adding or removing information from model will not force you to change anything on existing documents. Often, even simple data migrations will not need to update anything. The system will find and use automatically the correct serializer based on the version of the loaded document. More complex schema migrations, instead, will be easily managed with customizable tasks.

Automatic maintenance of denormalized information

Managing a denormalized database can be difficult when updating data. MongODM takes care of this automatically, identifying wherever there are obsolete denormalized data to be updated, and works with autonomous background tasks to keep a database always consistent.

Track all operations performed on data at the database context level

The seeding of a new database, or the migration to a new schema of a repository must be traced. Keep logs of what action have been performed on data at the database context level.

⚙️ Start to use

This framework is available for download via nuget. You can find packages on Etherna’s feed: https://www.nuget.org/profiles/etherna.

Find source code documentation on how to start to use it on GitHub: https://github.com/Etherna/mongodm