示例#1
0
    /// <inheritdoc/>
    public async Task <bool> TryPersist(ScopeId scopeId, IFilterDefinition filterDefinition, CancellationToken cancellationToken)
    {
        var tryGetStream = await _streamDefinitions.TryGet(scopeId, filterDefinition.TargetStream, cancellationToken).ConfigureAwait(false);

        if (!tryGetStream.Success)
        {
            return(false);
        }
        var newStreamDefinition = new StreamDefinition(filterDefinition);
        await _streamDefinitions.Persist(scopeId, newStreamDefinition, cancellationToken).ConfigureAwait(false);

        return(true);
    }