Saturday, November 30, 2013

Antler Framework: use the same syntax to work with different databases and different ORMs.

I am starting to contribute to Antler project which i believe may be useful for many .Net developers as well.

Antler is a simple framework for super-easy working with different databases(SQL CE, Sqlite, SqlExpress, SqlServer, Oracle etc) and different ORMs(NHibernate, EntityFramework Code First) using the same syntax.

Project is at an early stage, but we have a clear understanding of the requirements.

So, what are the requirements?
  • Support for multiple storages at the same time.
  • Use common syntax to work with them, so you can easily substitute one storage with another.
  • Have strong architectural base including UnitOfWork/DataSession/Repository etc. notions.
  • Be fully pluggable. For example, it should be damn easy to choose which storage or IoC container to use.
  • Good coverage by Unit/Integration tests. Most of the integration tests should pass for any combination of Database/ORM.

Configuration example

 var configurator = new AntlerConfigurator();  

Usage example

Adding teams to database:

 UnitOfWork.Do(uow =>  
    uow.Repo<Team>().Insert(new Team() {Name = "Super", BusinessGroup = "Great"});  
    uow.Repo<Team>().Insert(new Team() {Name = "Good", BusinessGroup = "Great"});  
    uow.Repo<Team>().Insert(new Team() {Name = "Bad", BusinessGroup = "BadBg"});  

Querying teams from database:

 var found = UnitOfWork.Do(uow => uow.Repo<Team>().AsQueryable().Where(t => t.BusinessGroup == "Great").OrderBy(t => t.Name).ToArray());  

Project is available on GitHub:
Everyone is welcome!

No comments:

Post a Comment