nopCommerce 2.10 with nHibernate 3.2.0

by paliktar 7. September 2011 12:40

NopCommerce it's a very good e-commerce open source platform and I'm working with since v1.1. In the background it uses EntityFramework 4.0 Code First which I consider it's not mature enough. Entity Framework 4.0 big minus I think is the lack of Cache Level 2. When you have an e-commerce site with more then 5.000 items we will fill the need of Cache Level 2

So I had started to implement nopCommerce with nHibernate. Doing this I wanted to make nopCommerce even better (from my perspective) and also accessible  to nHibernate lovers. 

There are a lot debates about which ORM is the best and I don't want to go deep in this discussion, you can check here some pros and cons: NHibernate vs. Entity Framework 4.0

The big lines of the modifications of nopCommerce 2.1 to work with nHibernate 3.2 are:

  1. new project Nop.Data.Nhib : contains all the mapping classes and DB stuff
  2. new project Nop.Services.Nhib: contains all the overrides needed by some services in order to work with nHibernate
  3. In Nop.Core all the domain entities were rewritten in order to make nHibernate to add and remove parent/children entities
  4. you can switch between nHibernate and EF from web.config by modifying in appSettings the key's value "useNhib" to true/false
  5. you can activate/stop cache level 2 from web.config by modifying in appSettings the key's value "cacheLevel2Enabled" to true/false
  6. in the project Nop.Web.Framework a new class was added NhibDependencyRegistrar were all the nhibernate specific Autofac injections take place
In the coming days I'll detail my nHibernate implementation in new posts.
 
Cutting the small talks you can download my implementation of nopCommerce 2.1 with nHibernate 3.2 down in this post.

If you encounter some problems please add here a comment.

 

nopCommerce_2.10_with-nHibernate_3.2.0.rar (29.1 mb)

Tags: ,

nHibernate