public IMessageProcessor Create(IUnitOfWork unitOfWork, IMessageMapper mappingEngine, CommandEngineConfiguration configuration) { return new MessageProcessor(mappingEngine, new CommandInvoker(new ValidationEngine(new ValidationRuleFactory()), new CommandFactory()), unitOfWork, configuration); }
public MessageProcessor(IMessageMapper mappingEngine, ICommandInvoker commandInvoker, IUnitOfWork unitOfWork, CommandEngineConfiguration configuration ) { _mappingEngine = mappingEngine; _commandInvoker = commandInvoker; _unitOfWork = unitOfWork; _configuration = configuration; }
public void Initialize(Assembly assembly, IMessageMapper messageMapper) { if (_mappingEngine == null) { lock (_lock) { if (_configuration == null) { Configuration = new CommandEngineConfiguration(); Configuration.Initialize(assembly); _mappingEngine = messageMapper; } } } }
private static void ConventionConfiguration(CommandEngineConfiguration configuration) { IEnumerable<Type> inputTypes = GetInputViewModelTypes(ConventionBasedViewModelInputType); IEnumerable<Type> messageTypes = GetCommandMessageTypes(ConventionBasedCommandMessageType); foreach (Type input in inputTypes) { if (!configuration.MessageConfigurations.ContainsKey(input)) { Type actualMessageType = messageTypes.FirstOrDefault(type => InputToCommandMessage(type, input)); if (actualMessageType != null) { configuration.MessageConfigurations.Add(input, new ConventionMessageConfiguration(actualMessageType)); } } } }