Pluggable framework to work with different databases(SQL CE, Sqlite, SqlExpress, SqlServer, Oracle etc.) and different ORMs(NHibernate, EntityFramework Code First) using the same syntax.
Inserting Teams in database:
UnitOfWork.Do(uow => { uow.Repo().Insert(new Team() {Name = "Super", BusinessGroup = "Great"}); uow.Repo().Insert(new Team() {Name = "Good", BusinessGroup = "Great"}); uow.Repo().Insert(new Team() {Name = "Bad", BusinessGroup = "BadBg"}); });
Querying Teams from database:
var found = UnitOfWork.Do(uow => uow.Repo().AsQueryable().Where(t => t.BusinessGroup == "Great").OrderBy(t => t.Name).ToArray());
For example, let's configure application to use (NHibernate + Sqlite database) and Castle Windsor container:
var configurator = new AntlerConfigurator(); configurator.UseWindsorContainer().UseStorage(NHibernatePlusSqlite.Use);
If we want to specify assembly with NHibernate mappings explicitly we can write:
var configurator = new AntlerConfigurator(); configurator.UseWindsorContainer().UseStorage(NHibernatePlusSqlite.Use.WithMappings(Assembly.GetExecutingAssembly()));
Let's configure application to use (EntityFramework Code First + Sql Compact database) and Castle Windsor container:
var configurator = new AntlerConfigurator(); configurator.UseWindsorContainer().UseStorage(EntityFrameworkPlusSqlCe.Use.WithConnectionString("Data Source=DB.sdf") .WithMappings(Assembly.GetExecutingAssembly()));
Largely based on the great NoSQL framework https://github.com/Kostassoid/Anodyne.