/// <summary> /// Instantiates a new <see cref="CommunicationController"/>. /// </summary> /// <param name="serverType"></param> /// <param name="clientType"></param> /// <param name="sharedServerChannelAddress"></param> /// <param name="sharedServerConfiguration"></param> /// <param name="transportController"></param> /// <param name="logSourceId"></param> public CommunicationController(Type serverType, Type clientType, Networking.IChannelAddress sharedServerChannelAddress, Networking.IServerConfiguration sharedServerConfiguration, Networking.ITransportController transportController, string logSourceId) : this() { ServerType = serverType ?? throw new ArgumentNullException("serverType"); ClientType = clientType ?? throw new ArgumentNullException("clientType"); SharedChannelAddress = sharedServerChannelAddress ?? throw new ArgumentNullException("sharedServerChannelAddress"); SharedServerConfiguration = sharedServerConfiguration ?? throw new ArgumentNullException("sharedServerConfiguration"); TransportController = transportController ?? throw new ArgumentNullException("transportController"); if (string.IsNullOrWhiteSpace(logSourceId)) { throw new ArgumentNullException(nameof(logSourceId)); } LogSourceId = logSourceId; }
private Networking.IServer InternalCreateServer(Networking.IChannelAddress channelAddress, Networking.IServerConfiguration configuration, string logSourceId) { if (string.IsNullOrWhiteSpace(logSourceId)) { throw new ArgumentNullException(nameof(logSourceId)); } var server = Activator.CreateInstance(ServerType) as Networking.IServer; server.Initialize(channelAddress, configuration, TransportController, logSourceId); return(server); }
/// <summary> /// Will use the given <see cref="Networking.IChannelAddress"/>, <see cref="Networking.IServerConfiguration"/> and LogSourceId to create a <see cref="Networking.IServer"/>. /// </summary> /// <param name="channelAddress">The <see cref="Networking.IChannelAddress"/> defining the required connection information.</param> /// <param name="configuration">The <see cref="Networking.IServerConfiguration"/> defining the required configuration information.</param> /// <param name="logSourceId"></param> /// <returns>A <see cref="Networking.IServer"/> created using the given <see cref="Networking.IChannelAddress"/>, <see cref="Networking.IServerConfiguration"/> and LogSourceId.</returns> public Networking.IServer CreateServer(Networking.IChannelAddress channelAddress, Networking.IServerConfiguration configuration, string logSourceId) => InternalCreateServer(channelAddress, configuration, logSourceId);