/// <summary> /// Initializes a new instance of the <see cref="CompositeCommandBase"/> class. This will set /// the <see cref="CompositeCommandIdentifier"/> to a identifier value generated by the /// <paramref name="idGenerator"/>. /// </summary> /// <param name="idGenerator">The id generator. This cannot be <c>null</c>.</param> protected CompositeCommandBase(IUniqueIdentifierGenerator idGenerator) { Contract.Requires <ArgumentNullException>(idGenerator != null); CompositeCommandIdentifier = idGenerator.GenerateNewId(); _commands = new List <ICommand>(); }
/// <summary> /// Initializes a new instance of the <see cref="CommandBase"/> class. This will set /// the <see cref="CommandIdentifier"/> to a identifier value generated by the /// <paramref name="idGenerator"/>. /// </summary> /// <param name="idGenerator">The id generator. This cannot be <c>null</c>.</param> protected CommandBase(IUniqueIdentifierGenerator idGenerator) { Contract.Requires <ArgumentNullException>(idGenerator != null); CommandIdentifier = idGenerator.GenerateNewId(); CompositeCommandIdentifier = Guid.Empty; }
/// <summary> /// Initializes a new instance of the <see cref="CommandBase"/> class. This will set /// the <see cref="CommandIdentifier"/> to a identifier value generated by the /// <paramref name="idGenerator"/>. /// </summary> /// <param name="idGenerator">The id generator. This cannot be <c>null</c>.</param> protected CommandBase(IUniqueIdentifierGenerator idGenerator) { Contract.Requires<ArgumentNullException>(idGenerator != null); CommandIdentifier = idGenerator.GenerateNewId(); CompositeCommandIdentifier = Guid.Empty; }
/// <summary> /// Initializes a new instance of the <see cref="CompositeCommandBase"/> class. This will set /// the <see cref="CompositeCommandIdentifier"/> to a identifier value generated by the /// <paramref name="idGenerator"/>. /// </summary> /// <param name="idGenerator">The id generator. This cannot be <c>null</c>.</param> protected CompositeCommandBase(IUniqueIdentifierGenerator idGenerator) { Contract.Requires<ArgumentNullException>(idGenerator != null); CompositeCommandIdentifier = idGenerator.GenerateNewId(); _commands = new List<ICommand>(); }
public FooCommand(IUniqueIdentifierGenerator idGenerator) : base(idGenerator) { }
public IdentifiableWebSocket(IUniqueIdentifierGenerator idGenerator, WebSocket socket) { _socket = socket; Id = idGenerator.Next(); }
/// <summary> /// Initializes a new instance of the <see cref="EventSource"/> class. /// </summary> protected EventSource() { _idGenerator = NcqrsEnvironment.Get <IUniqueIdentifierGenerator>(); EventSourceId = _idGenerator.GenerateNewId(); }
public FooCommand(IUniqueIdentifierGenerator idGenerator) : base(idGenerator) { }
/// <summary> /// Initializes a new instance of the <see cref="EventSource"/> class. /// </summary> protected EventSource() { _idGenerator = NcqrsEnvironment.Get<IUniqueIdentifierGenerator>(); EventSourceId = _idGenerator.GenerateNewId(); }
/// <summary> /// Invoke in asp.net core pipeline /// </summary> /// <param name="context">Http context</param> /// <param name="webSocketHandler">Websocket handler</param> /// <param name="idGenerator">Unique Id generator</param> public async Task Invoke(HttpContext context, IWebSocketHandler webSocketHandler, IUniqueIdentifierGenerator idGenerator) { if (!context.WebSockets.IsWebSocketRequest) { return; } var socket = new IdentifiableWebSocket(idGenerator, await context.WebSockets.AcceptWebSocketAsync()); await webSocketHandler.HandleAsync(socket, _cancellationToken); }