A while ago, I have released EFMVC, a demo web app built using ASP.NET MVC 3, EF Code First and Unity. The EFMVC app has demonstrated many architectural patterns and practices such as Generic Repository, Repository pattern, Unit of Work pattern, Dependency Injection pattern and Application Service later. Today I would like to announce the release of EFMVC 1.0 Preview. This release is an early preview release that has made some changes in the solution architecture. The preview is written in ASP.NET MVC 3 version and will be migrated to ASP.NET MVC 4 with new features on later.
Changes in EFMVC 1.0
In EFMVC 1.0, I have made some changes on the solution architecture. I have completely re-written the Application Service layer where I have added some CQRS flavor on the Solution Architecture. But please keep in mind that this is not the implementation of CQRS pattern. Now every write operations (Create, Update and Delete) represent a command and these commands will be executed by using a Command Handler. These command handlers would be hooked by a command dispatcher based on the command type. The following code in the Controller class is creating a Command object and will submit to the Command Bus. Before submitting the Command, we validate the Command object using the validate method of Command Bus.
The following code is shown the Command Handler for command object CreateOrUpdateCategoryCommand.
The right Command Handler would be hooked by a Command Dispatcher object based on the command type. The following code is shown the implementation of Command Dispatcher object.
The current version is executing the command in synchronous way and future versions will be provide the support for executing the commands asynchronous way using a different architecture approach. The latest EFMVC version is using Autofac for dependency injection over Microsoft Unity.
You can download the source code from http://efmvc.codeplex.com