Micro ORMs, alternatives to Entity Framework ? Part 9


<< Previous article (Part 8)

What conclusion(s) can we make ?

Let’s summarize first principals features we described for each Micro ORM before in a user friendly table here:

Legends :






 Yes, but not verified

Note that they :

  • All support the execution of stored procedures, views, functions
  • Are all protected from SQL injection (queries parameterization)

What we liked ?

  • NPoco for simplicity of its syntax and performance
  • Dapper for its outstanding performance and its amazing community
  • OrmLite for its double LINQ-like and SQL syntax, and for its rich functionalities and performance


Even if we love some Micro ORMs and they are more performant than Entity Framework, they don’t provide all Entity Framework’s functionalities, and they don’t support unit tests as Entity Framework does (by mocking its DbContext).

In fact it depends on what you are looking for 🙂

I hope this suite of articles helped you to make a choice 😉

If you need to check the source code, you can find it here : https://github.com/AnthonyGiretti/MicroOrmDemo.net

Micro ORMs, alternatives to Entity Framework ? Part 1

Story of Entity framework and Micro ORMs


The arrival 10 years ago of Entity Framework allowed to query a database without writing a single line of SQL.
=> This has helped to increase developers productivity.

How looked like a query before Entity Framework ?

And after….?

Awesome right ? 🙂

And Micro ORMs arrived….

New ORMs named “Micro ORM” came some years after Entity Framework, “lightweight declensions” of famous ORM like Entity Framework or NHibernate.

The purpose of their existence is to be more simple to use and performant by offering the most basic database query functions.


As you can see, many Micro ORMs have been released

In the second part of this article we will describe more some Micro ORMs, the oldest (so potentially the most mature) like :

1- Simple.Data

2- Massive

3- OrmLite

4- Peta Poco

5- NPoco

6- Dapper


Let’s go the the second part here.

Micro ORMs, alternatives to Entity Framework ? Part 2


<< Previous article (Part 1)

Introduction of some Micro ORMs: Simple.Data

Scenario Used

In order to show reusable examples, I’m using AdventureWork Database (2014), you can download it here.

I will use the WorkOrder table and the Product table, I will use also a business project named Orders that is a projection on there two tables.

Some Micro ORMs are able to manage relationships between tables and populate objects linked by a navigation property, some not, so we will use the projection instead of entities introduced before.


  • It’s syntax is fully dynamic syntax, consequence: no IntelliSense
  • Compatible with multiple databases: SQL Server, Oracle, Mysql, SqlLite, PostgreSql, SqlAnyWhere, Informix Microsoft Access
  • Uncomplicated syntax (LINQ-like)
  • Supports transactions
  • Mandatory to create an AdHoc query to populate an object (relationships are not supported)
  • Weird database connection management : « Simple.Data is quite aggressive in closing connections and holds no open connections to a data store by default, so you can keep the Database object returned from the Open*() methods hanging around without worrying.»
  • Not testable unitarily
  • Doesn’t provide Async queries
  • Not compatible with .NET Core
  • Was promising but unfortunately it is no longer updated since 2013

Code samples :

Required entities and business objects for our scenario :

public class Orders
        public Orders() { }

        public int Id { get; set; }
        public string ProductName { get; set; }
        public int? Quantity { get; set; }
        public DateTime? Date { get; set; }

    //Db entity
    public class WorkOrder
        public WorkOrder() { }

        public int WorkOrderId { get; set; }
        public int ProductID { get; set; }
        public int? OrderQty { get; set; }
        public int? StockedQty { get; set; }
        public int? ScrappedQty { get; set; }
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; }
        public DateTime? DueDate { get; set; }
        public int? ScrapReasonID { get; set; }
        public DateTime? ModifiedDate { get; set; }

Repository sample :

public class MassiveRepository
public class SimpleDataRepository
        private dynamic _dbConnection;
        private dynamic _workerId;
        private dynamic _productName;
        private dynamic _orderQty;
        private dynamic _dueDate;

        public SimpleDataRepository()
            _dbConnection = Database.OpenNamedConnection("AdventureWorks2014");
            _workerId = _dbConnection.WorkOrder.WorkOrderID;
            _productName = _dbConnection.WorkOrder.Product.Name;
            _orderQty = _dbConnection.WorkOrder.OrderQty;
            _dueDate = _dbConnection.WorkOrder.DueDate;

        public List GetOrders()
            List data = _dbConnection.WorkOrder.Select(_workerId, _productName, _orderQty, _dueDate).Skip(0).Take(500);

            return data.Select(x => new Orders
                Id = x.WorkOrderID,
                ProductName = x.Name,
                Quantity = x.OrderQty,
                Date = x.DueDate

        public Orders GetOrderById(int id)
            dynamic data = _dbConnection.WorkOrder.Select(_workerId, _productName, _orderQty, _dueDate).Find(_workerId == id);

            return new Orders
                Id = data.WorkOrderID,
                ProductName = data.Name,
                Quantity = data.OrderQty,
                Date = data.DueDate

        public void Add(WorkOrder workOrder)
            //dynamic data = _dbConnection.WorkOrder.Insert(ProductId : 1, OrderQty : 10, StockedQty : 50 .......);

        public void Update(WorkOrder workOrder)
            //_dbConnection.WorkOrder.Update(WorkOrderId: workOrder.WorkOrderId);

        public void Delete(WorkOrder workOrder)
            //_dbConnection.WorkOrder.Delete(WorkOrderId: workOrder.WorkOrderId);

Like it’s name Simple.Data is very simple !


Let’s go to see how Massive works