开发者

CQRS, WPF, form filling

开发者 https://www.devze.com 2023-03-22 03:54 出处:网络
I\'ve just read the following cqrs article. It makes perfect sense, but didn\'t answer the question I was originally researching. Ignoring the question of whether it makes sense to do so, what would b

I've just read the following cqrs article. It makes perfect sense, but didn't answer the question I was originally researching. Ignoring the question of whether it makes sense to do so, what would be the CQRS approach to creating a new record? In the article they have this image:

CQRS, WPF, form filling

They show that DTO based would have you change the status field, task based would have a task button labelled "Deactivate".

Now, imagine the job here wasn't just deactivating the product, but creating a new one. You've got to fill all the fields in, de开发者_Python百科al with validation issues. How does that work in a CQRS world?

I'm starting to come to the conclusion that in my WPF world, my ViewModel/View would operate as usual, containing validation and so forth, but the CQRS Add verb method would be something simple like Add(DTO) where DTO is basically a DTO...


You can take a look at Udi Dahan's MSDN article where he talks through these issues.

My basic take is you send a creation message and the object is either valid or not, and you can let the user know about issues later if need be.


It's likely not much different than the "deactivate" case. The only difference (besides the fact that you now have different command with likely different fields) is that you're still going to want to perform the validation at the command processor because it can't guarantee that what data it gets is always from a reliable source.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号