Refactored and Commands and Queries!

Nov 20, 2011 at 12:35 AM

What's up, what's up?   lol

I refactored the app to move the projects around per Shawn's suggestions.  It's very clean, and I like it a lot.

Also, I added commands and queries to look at an alternative to using application services.  I really like the approach a lot more.  Don't worry, it doesn't have a ton of interfaces; in fact, there is not one interface involving commands or queries.

Please take a look at them - you can see how they are used in the FooController page.  Look for the term "// vs" and you'll see two of the action methods have both the old request/response approach compared with the commands and queries.  It's not much different.  I just think the commands and queries are more self documenting and makes for a more flexible design.  I also put in a method to ExecuteAsTransaction on the abstract command class so we can call commands from other commands if we need to.

Let me know what you guys think. 

Also - what's you guy's opinions on enforcing business rules per command and/or query instead of just on the entity itself.  The thinking being that the rules for one command may be different from another command even if it's updating the same entity.  Just something to think about.  Let me know.