internal void RegisterCommandAspect(Type channelType, Type commandAspectType, CommandAspect cf) { Known(channelType); var channelId = channelType.FullName; if (!_channelAspectsCommand.ContainsKey(channelId)) { _channelAspectsCommand[channelId] = new Dictionary <string, CommandAspect>(); } var aspects = _channelAspectsCommand[channelId]; var aspectId = commandAspectType.FullName; if (!aspects.ContainsKey(aspectId)) { aspects[aspectId] = cf; } else { throw new TectureException($"Attempt to bind command aspect {commandAspectType.FullName} twice for channel {channelType.Name}"); } cf._aux = _auxiliary.ForChannel(channelType); cf._channel = channelType; cf.CallOnRegister(); }
internal void RegisterCommandAspect(Type channelType, Type commandAspectType, CommandAspect cf) { Known(channelType); var channeId = channelType.FullName; if (!_channelAspectsCommand.ContainsKey(channeId)) { _channelAspectsCommand[channeId] = new Dictionary <string, CommandAspect>(); } var aspects = _channelAspectsCommand[channeId]; var aspectId = commandAspectType.FullName; if (!aspects.ContainsKey(aspectId)) { aspects[aspectId] = cf; } else { throw new TectureException($"Command aspect {commandAspectType.Name} is already implemented for {channelType.Name}"); } cf._aux = _auxilary.ForChannel(channelType); cf.CallOnRegister(); }
internal void RegisterCommandAspect(Type channelType, Type commandAspectType, CommandAspect cf) { EnsureKnown(channelType); var channelId = channelType.FullName; if (!_channelAspectsCommand.ContainsKey(channelId)) { _channelAspectsCommand[channelId] = new Dictionary <string, CommandAspect>(); } var aspects = _channelAspectsCommand[channelId]; var aspectId = commandAspectType.FullName; if (!aspects.ContainsKey(aspectId)) { aspects[aspectId] = cf; } else { throw new TectureException($"Attempt to bind command aspect {commandAspectType.FullName} twice for channel {channelType.Name}"); } if (!_channelCommandAspect.ContainsKey(channelId)) { _channelCommandAspect[channelId] = new Dictionary <Type, CommandAspect>(); } var servingCommands = _channelCommandAspect[channelId]; foreach (var cfServingCommandType in cf.ServingCommandTypes) { if (servingCommands.ContainsKey(cfServingCommandType)) { throw new TectureException( $"Command {cfServingCommandType.Name} is already being served by command aspect {commandAspectType.FullName} in context of channel {channelId}"); } servingCommands[cfServingCommandType] = cf; } cf._context = _testingContext.ForChannel(channelType); cf._channel = channelType; cf.CallOnRegister(); }