Skip to content

BROKERS: StorageBroker contains logic against The Standard #191

@5ko100yanov

Description

@5ko100yanov

According to The Standard, logic doesn't live at the broker because you can't test-drive it.

The existing StorageBroker methods have logic. Sequencing is a kind of logic too, try-catch-finally as well.

Beeing untested, the StorageBroker has a hidden bug. Lets dig into:

private async ValueTask<T> UpdateAsync<T>(T @object)
{
    this.Entry(@object).State = EntityState.Modified;
    await this.SaveChangesAsync();
    DetachEntity(@object);
    
    return @object;
}

If SaveChangesAsync fails, @object will remain Attached and tracked as Modified.

Any subsequent call to a Broker method will update the @object from the failed call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions