Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@vladikk
CreatedMarch 19, 2017 14:57
    • Star(10)You must be signed in to star a gist
    • Fork(6)You must be signed in to fork a gist
    Save vladikk/86da55d0eb09d7a291b9f9a5b406f2c9 to your computer and use it in GitHub Desktop.
    Command execution result object for CQRS based systems
    usingSystem;
    namespaceExample
    {
    publicabstractclassExecutionResult
    {
    protectedExecutionResult(GuidaggregateId,GuidcommandId,DateTimeexecutedOn)
    {
    AggregateId=aggregateId;
    CommandId=commandId;
    ExecutedOn=executedOn;
    }
    publicGuidAggregateId{get;privateset;}
    publicGuidCommandId{get;privateset;}
    publicDateTimeExecutedOn{get;privateset;}
    publicabstractboolIsSuccess{get;}
    publicclassSuccess:ExecutionResult
    {
    publicSuccess(GuidaggregateId,GuidcommandId,DateTimeexecutedOn,intaggregateVersion):base(aggregateId,commandId,executedOn)
    {
    AggregateVersion=aggregateVersion;
    }
    publicoverrideboolIsSuccess=>true;
    publicintAggregateVersion{get;privateset;}
    }
    publicclassSuccess<TPayload>:Success
    {
    publicSuccess(GuidaggregateId,GuidcommandId,DateTimeexecutedOn,intaggregateVersion,TPayloaddata):base(aggregateId,commandId,executedOn,aggregateVersion)
    {
    Data=data;
    }
    publicTPayloadData{get;privateset;}
    }
    publicclassFailure:ExecutionResult
    {
    publicFailure(GuidaggregateId,GuidcommandId,DateTimeexecutedOn,string[]errorMessages):base(aggregateId,commandId,executedOn)
    {
    ErrorMessages=errorMessages;
    }
    publicoverrideboolIsSuccess=>false;
    publicstring[]ErrorMessages{get;privateset;}
    }
    }
    }
    @NargiT
    Copy link

    What is the aggregatedId some kind of correlation id ?

    @MateuszNaKodach
    Copy link

    What is the aggregatedId some kind of correlation id ?

    AggregateId is an id of an aggregate against which the command is executed. The aggregate concepts comes from Domain-Driven Design.

    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

    [8]ページ先頭

    ©2009-2025 Movatter.jp