Designing a Short Course on IoC: Day 3
Is it just me, or am I slowing down? Yesterday was a busy day of programming, but there’s still a long way to go before this application is going to cut the mustard as an example for the course.
In the end, I went with the idea of a timesheeting application. Simple material keeps out of the way, and to be honest, there is so little logic or fancy presentation in this app that it could be changed from timesheets to another example in a relatively short space of time if need be.
Up and running, we have:
A basic MVC3 app layout
IoC set up to create controllers
Data access with NHibernate
Transaction management integrated with MVC
Logging with the venerable log4net
A skeleton for ‘pick-me-up’ domain events
It is the last item that I’ll be working on in depth today. ‘Pick-me-up’ domain events integrate domain models with external services in a way that plays better with IoC than the thread-static
DomainEvents.Raise() pattern commonly seen elsewhere.
Dispatching events to handlers is also a good example of the ‘generic handler’ pattern that’s very widely used, and registering handlers will provide some further examples for convention-based/scanning registration.
To complete the day I’m aiming to polish up the last details of the basic MVC site (for example, error handling) and bed down an example of processing work in a background process to use in the “Resources and Units of Work” session. That leaves tomorrow and Friday for more detailed work on slides, some code samples for the “Containers” session, and some reworking of the example to fit into the flow of the course.