Command not executing

Dec 27, 2012 at 7:57 PM
Edited Dec 28, 2012 at 7:05 AM


I have successfully extracted and integrated 90% of the architecture from this solution into my own but I am having one small issue which I am struggling with in regards to getting it working or even understood at what the possible issue could be.


I actually took the following code exactly from your project line by line into my own:

  • EFMVC.CommandProcessor
  • EFMVC.Core
  • EFMVC.Data
  • EFMVC.Domain
  • EFMVC.Model
  • EFMVC.Web.Core

I am using my own Web MVC 4 solution am I am following the design patterns for the command and handlers but once I hit the command.Validate function  things go awry. Here is the code I am having issues with.


EFMVC.Domain: CreateOrUpdateTripCommand.cs

public class CreateOrUpdateTripCommand : ICommand    {
public CreateOrUpdateTripCommand(int TripId, int PackageId, int CustomerId, string Name)
  this.TripId = TripId;
  this.PackageId = PackageId;
  this.CustomerId = CustomerId;
  this.Name = Name;
public int TripId { get; set; }
public int PackageId { get; set; }
public int CustomerId { get; set; }
public string Name { get; set; }


MY.Web: TripControlle.cs - (Save) function

var command = Mapper.Map<TripFormModel, CreateOrUpdateTripCommand>(form);
IEnumerable<ValidationResult> errors = _commandBus.Validate(command);


EFMVC.CommandProcessor: DefaultCommandBus.cs - (Validate) function

var handler = DependencyResolver.Current.GetService<IValidationHandler<TCommand>>();

This returns a null handler and does not enter into the DatabaseFactory and UnitOfWork classes like it does in your solution. I know this is not an ideal discussion to post but I am being hopeful and optimistic and you might have some insight to offer.

I have validate that the TCommand is actually EFMVC.Domain.Commands.CreateOrUpdateTripCommand

My assumptions are around the DependencyResolver.Current.GetService function. Is it possible that I need to register my commands in the bootstrapper. I did not see any of your commands in there but thats all I can gather from what is in front of me.