Reviewing Mendz.Data.Common

The Mendz.Data.Common namespace provides the APIs needed to create Mendz.Data-aware contexts and repositories. Here's to understanding the main classes and types in this namespace.

Nothing beats simple... and Mendz.Data.Common delivers.

Contexts

Entity Framework's DbContext is cool. If you have a client/driver that is not "context compatible" (like ADO.Net clients/drivers), you can use IDbDataContext to make them "context compatible" -- which I use to mean "can be used like a DbContext instance".

IDbDataContext is implemented by GenericDbDataContextBase. This is focused on managing connections. Use this base class to define a context instance for clients/drivers that are not ADO.Net compatible.

GenericDbDataContextBase is derived by DbDataContextBase, which also implements IDbDataTransaction. DbDataContextBase is focused on managing ADO.Net compatible connections and transactions. Use this base class to define a context instance for clients/drivers that are ADO.Net compatible.

Repositories

DbRepositoryBase is the base class for defining repositories. It requires a semi-self-initializing context. This can be a DbContext instance or an IDbDataContext-based context instance that can be created/opened via parameter-less constructor. Note that DbRepositoryBase implements IDisposable. Repositories based on DbRepositoryBase can be used in "using() {}" code block.

Find more discussions and samples at Mendz.Data readme and Mendz.Data wiki.

Get Mendz.Data and enjoy the benefits of simplifying how your contexts and repositories are developed.

Comments