command-query-separation

Should the rule “one transaction per aggregate” be taken into consideration when modeling the domain?

*爱你&永不变心* 提交于 2019-12-12 08:14:54
问题 Taking into consideration the domain events pattern and this post , why do people recomend keeping one aggregate per transaction model ? There are good cases when one aggregate could change the state of another one . Even by removing an aggregate (or altering it's identity) will lead to altering the state of other aggregates that reference it. Some people say that keeping one transaction per aggregates help scalability (keeping one aggregate per server) . But doesn't this type of thinking

How would one apply command query separation (CQS), when result data is needed from a command?

冷暖自知 提交于 2019-12-03 01:26:30
问题 In wikipedia's definition of command query separation, it is stated that More formally, methods should return a value only if they are referentially transparent and hence possess no side effects. If I am issuing a command, how should I determine or report whether that command was successful, since by this definition the function cannot return data? For example: string result = _storeService.PurchaseItem(buyer, item); This call has both a command and query in it, but the query portion is

How would one apply command query separation (CQS), when result data is needed from a command?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 14:49:16
In wikipedia's definition of command query separation , it is stated that More formally, methods should return a value only if they are referentially transparent and hence possess no side effects. If I am issuing a command, how should I determine or report whether that command was successful, since by this definition the function cannot return data? For example: string result = _storeService.PurchaseItem(buyer, item); This call has both a command and query in it, but the query portion is result of the command. I guess I could refactor this using the command pattern, like so: PurchaseOrder

Change current implementation of basic MVVM to adhere to SOLID pattern

拥有回忆 提交于 2019-12-02 13:11:51
问题 I have been writing all my MVVM application with basic design pattern generally mentioned in MVVM examples available online. The pattern that I am following is described below: Model This section include DTO classes with their properties and Interfaces IDataService and like: public class Employee { public string EmployeeName { get; set; } public string EmployeeDesignation { get; set; } public string EmployeeID { get; set; } } public interface IDataService { public Task<Employee>

Is returning a Task violating the CQS-principle?

守給你的承諾、 提交于 2019-12-01 17:11:51
问题 The CQS-principle (https://en.wikipedia.org/wiki/Command%E2%80%93query_separation) states that a command should return void. The recommendation for async methods is to never return void (https://msdn.microsoft.com/en-us/magazine/jj991977.aspx), but instead returning a Task. So, if I write an async command, will that inevitably break the CQS-principle? 回答1: At the level of considering what you want to know (a query) or do (a command) then Task<T> gives you data and hence is correct for a query