c# - REST API (CQRS) partial response -
i'm building http rest api , implementing cqrs pattern api.
i have following projects (see below).
project.core
- project.core.commands - contains icommand, icommandhandler , icommanddispatcher.
- project.core.queries - contains iquery, iqueryhandler , iquerydispatcher.
- project.core.commands.impl - contains icommanddispatcher implementation , decorators command handlers.
- project.core.queries.impl - contains iquerydispatcher implementation , decorators query handlers.
project.cars
- project.cars.queries - contains queries , validators.
- project.cars.queryhandlers - contains handlers queries
i'm storing query result classes in project.cars.queries. each query has own result class.
in api want provide ability filter result fields. how can it?
now have 2 options:
- create project.cars.readmodel project. queries "getcarslist" , "getcarbyid" return model same type (car). in asp.net core app serialize fields user asks.
- queries have property "fields" , read fields directly db. don't know read model in case.
Comments
Post a Comment