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(); }
public void RegisterCommandAspect(Type commandAspectType, CommandAspect aspect) { _multiplexer.RegisterCommandAspect(_channelType, commandAspectType, aspect); }
/// <summary> /// Configures saver for channel /// </summary> /// <typeparam name="TAspect">Aspect type</typeparam> /// <typeparam name="TCommand1">Type of command #1 that is being supported by aspect</typeparam> /// <typeparam name="TCommand2">Type of command #2 that is being supported by aspect</typeparam> /// <typeparam name="TCommand3">Type of command #3 that is being supported by aspect</typeparam> /// <typeparam name="TCommand4">Type of command #4 that is being supported by aspect</typeparam> /// <param name="cf">Channel configuration</param> /// <param name="aspect">Command aspect instance</param> /// <param name="saver">Corresponding saver instance</param> public static void ForCommand <TAspect, TCommand1, TCommand2, TCommand3, TCommand4>(this ChannelBinding <CommandChannel <TAspect> > cf, CommandAspect <TCommand1, TCommand2, TCommand3, TCommand4> aspect) where TAspect : CommandAspect <TCommand1, TCommand2, TCommand3, TCommand4> where TCommand1 : CommandBase where TCommand2 : CommandBase where TCommand3 : CommandBase where TCommand4 : CommandBase { var holder = cf as ChannelConfigurator; holder.RegisterCommandAspect(typeof(TAspect), aspect); }
/// <summary> /// Configures saver for channel /// </summary> /// <typeparam name="TAspect">Aspect type</typeparam> /// <typeparam name="TCommand1">Type of command #1 that is being supported by aspect</typeparam> /// <typeparam name="TCommand2">Type of command #2 that is being supported by aspect</typeparam> /// <typeparam name="TCommand3">Type of command #3 that is being supported by aspect</typeparam> /// <typeparam name="TCommand4">Type of command #4 that is being supported by aspect</typeparam> /// <typeparam name="TCommand5">Type of command #5 that is being supported by aspect</typeparam> /// <typeparam name="TCommand6">Type of command #6 that is being supported by aspect</typeparam> /// <typeparam name="TCommand7">Type of command #7 that is being supported by aspect</typeparam> /// <typeparam name="TCommand8">Type of command #8 that is being supported by aspect</typeparam> /// <typeparam name="TCommand9">Type of command #9 that is being supported by aspect</typeparam> /// <typeparam name="TCommand10">Type of command #10 that is being supported by aspect</typeparam> /// <typeparam name="TCommand11">Type of command #11 that is being supported by aspect</typeparam> /// <typeparam name="TCommand12">Type of command #12 that is being supported by aspect</typeparam> /// <typeparam name="TCommand13">Type of command #13 that is being supported by aspect</typeparam> /// <typeparam name="TCommand14">Type of command #14 that is being supported by aspect</typeparam> /// <typeparam name="TCommand15">Type of command #15 that is being supported by aspect</typeparam> /// <typeparam name="TCommand16">Type of command #16 that is being supported by aspect</typeparam> /// <param name="cf">Channel configuration</param> /// <param name="aspect">Command aspect instance</param> /// <param name="saver">Corresponding saver instance</param> public static void ForCommand <TAspect, TCommand1, TCommand2, TCommand3, TCommand4, TCommand5, TCommand6, TCommand7, TCommand8, TCommand9, TCommand10, TCommand11, TCommand12, TCommand13, TCommand14, TCommand15, TCommand16>(this ChannelBinding <CommandChannel <TAspect> > cf, CommandAspect <TCommand1, TCommand2, TCommand3, TCommand4, TCommand5, TCommand6, TCommand7, TCommand8, TCommand9, TCommand10, TCommand11, TCommand12, TCommand13, TCommand14, TCommand15, TCommand16> aspect) where TAspect : CommandAspect <TCommand1, TCommand2, TCommand3, TCommand4, TCommand5, TCommand6, TCommand7, TCommand8, TCommand9, TCommand10, TCommand11, TCommand12, TCommand13, TCommand14, TCommand15, TCommand16> where TCommand1 : CommandBase where TCommand2 : CommandBase where TCommand3 : CommandBase where TCommand4 : CommandBase where TCommand5 : CommandBase where TCommand6 : CommandBase where TCommand7 : CommandBase where TCommand8 : CommandBase where TCommand9 : CommandBase where TCommand10 : CommandBase where TCommand11 : CommandBase where TCommand12 : CommandBase where TCommand13 : CommandBase where TCommand14 : CommandBase where TCommand15 : CommandBase where TCommand16 : CommandBase { var holder = cf as ChannelConfigurator; holder.RegisterCommandAspect(typeof(TAspect), aspect); }