Skip to content

Usage with DDD #4

@dgaspar

Description

@dgaspar

Let's say I want to rely on a Specification inside my domain model's setter method (that will mutate the object) and reuse it when validating a Command at the Application layer (and be able to map the error back to the right UI field).

If my ISpecification<T> uses the domain model as T, then I first need to create a "corrupted" domain object (one that doesn't respect the invariants) to then be able to validate it against the specs.
If my ISpecification<T> uses the application layer's DTO as T, then I can't reuse it in the domain method because they're not the same type..

Would you be able to add a Create(Movie movie) controller action to this repo, to demonstrate how you would deal with the above problem, please? Would you still rely on the Specification pattern for that command validation (i.e., having common/reusable validation units)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions