Implementation questions

Aug 1, 2012 at 6:53 PM

Hi Matt,

Thank you VERY much for creating this project. I've reviewed several example projects for the Onion Architecture and I found yours to be the most elegant so far. That doesn't mean I don't have questions, though.

First, is there any documentation for this project? I spent about 6 hours troubleshooting my project after deciding on using SimpleInjector for my IoC container rather than Unity because I thought I implemented something incorrectly. I was double-checking project references, going through config files, changing code, even implementing a Unity to be exactly the same as your project, and basically bashing my head against the wall to see what I'd misconfigured. Turns out that it was simply because I hadn't set my build output folder for the DependencyResolution project to my UI project's bin folder.

While doing all that head bashing I stumbled upon a few things in your project for which I see no usage. First among those is the App.config in Core. I excluded it from the project and everything still works. My guess is that's because Entity Framework is an Infrastructure concern so it isn't needed. Am I on the mark or missing something?

I also saw no usage of DependencyHttpModule in DependencyResolution. Finally, I saw no usage of the classes within DependencyInjectionRecap.cs. Excluding all of those items seemed to have no impact to the functioning of the application. I say that with the caveat that with or without the files I could not actually order any of the products, just add them to my cart. I assume that was simply because the OrderProcessingService had no data to process against. I saw no documentation saying that I needed to do something for this to work but neither did I care since my goal was to understand the architecture and this does that well enough.

One last thing: I am creating an architectural framework for my organization based on the Onion Architecture and your example. In doing so, I am creating documentation to ease the transition from the traditional layered architecture that we've been using for years. I would be happy to share the documentation with you to add to your project. It would be great not only because it enriches your project but also confirms my understanding of it and the Onion Architecture. 



Aug 1, 2012 at 10:01 PM

Hi Jack,

Glad to see this reference project has helped you.

First, the bad news. There isn't really any documentation for this project. I use it when I give a presentation on Onion Architecture, but for some reason never got around to writing any blog post or anything.

But there is good news! I just published an update to the Source Code that cleans things up a bit.

  1. DependencyResolution no longer has a hidden OutputPath to ..\UI\bin
  2. Instead, it uses a new NuGet package I just created called OutputTo, which creates an OutputTargets.txt file that is hopefully a little more obvious than the previous solution. It also allows multiple output folders, which comes in handy
  3. Unity was replaced with Ninject, mostly as an experiment, but I left it in. The UnityServiceLocator is still in the source, but it's been Excluded from the project
  4. App.config was removed from Core, it was not used.
  5. DependencyHttpModule has also been Excluded from the project, since most people won't need it. It is only necessary for ASP.NET <3.5 projects, so I leave it in the source for those unfortunate projects that are very old.
  6. DependencyInjectionRecap.cs is strictly used for my presentation. I use it to walk through the basics of IOC to make sure the audience understands. You won't need it for anything.
  7. Lastly, I would be happy to check out your documentation when you're done!