We’ve already started doing some refactoring of dashCommerce for V.Next. Right now, I have been doing the work on my code base for dashCommerce.com because I usually guinea pig that first to see how stuff is going to work. With the next rev, we are going to be introducing some Dependency Injection and IoC in order to loosen the application up. I mentioned this in dashCommerce and a crowbar.

In the Web project I have a ServiceRegistry class that simply loads the “Store” container and then the services are available off the ServiceRegistry. So, there are calls right now, like this:

lblRetailPriceAmount.Text = ServiceRegistry.CurrencyService.GetConvertedAmount(_product.RetailPrice, convertCode);

- and -

 

productCollection = ServiceRegistry.CatalogService.FetchProductsByCategoryId(categoryId) as ProductCollection;   

These services then use the respective cache to pull the objects / values. So, the call stack looks like this:

CatalogService : ICatalogService

   calls to — > CategoryCache and ProductCache

      calls to –> CategoryController and ProductController

 

CurrencyService : ICurrencyService

   calls to –> CurrencyRateCache

      calls to –> CurrencyService

 

Do you see anything wrong with this? 

I’ve also started moving all of the interfaces to a separate assembly in order to decrease the dependencies. Logically, the only reference Web should have is to the assembly that contains the interfaces while the dependency injection / IoC will take care of building up the services. Also, Store would also have a ServiceRegistry class that builds up any of the Core stuff that is required.

What do you think? Suggestions, comments, etc????

kick it on DotNetKicks.com