Does validation in CQRS have to occur separately once in the UI, and once in the business domain?

I think my question has just been solved by another article, Clarified CQRS by Udi Dahan. The section “Commands and Validation” starts as follows: Commands and Validation In thinking through what could make a command fail, one topic that comes up is validation. Validation is different from business rules in that it states a context-independent … Read more

How to separate web components to individual files and load them?

In the main file, use <script> to load the Javascript file x-counter.js. In the Javascript file, use fetch() to load the HTML code x-counter.html. In the HTML file, use <link rel=”stylesheet”> to load the CSS file x-counter.css. CSS file : x-counter.css button, p { display: inline-block; color: dodgerblue; } HTML file : x-counter.html <link rel=”stylesheet” … Read more

Reactjs separation of UI and business logic

Yes it is possible, That is called as Separation of concern. You can create your component structure as below. MyComponentDirectory – useCustomHook – Component – helper The code will look like this one. Hook const useCustomHook = () => { const [value, setValue] = useState(”); const handleClick = (value) => { setValue(value) //do something. }; … Read more

How to map View Model back to Domain Model in a POST action?

I use an IBuilder interface and implement it using the ValueInjecter public interface IBuilder<TEntity, TViewModel> { TEntity BuildEntity(TViewModel viewModel); TViewModel BuildViewModel(TEntity entity); TViewModel RebuildViewModel(TViewModel viewModel); } … (implementation) RebuildViewModel just calls BuildViewModel(BuilEntity(viewModel)) [HttpPost] public ActionResult Update(ViewModel model) { if(!ModelState.IsValid) { return View(builder.RebuildViewModel(model); } service.SaveOrUpdate(builder.BuildEntity(model)); return RedirectToAction(“Index”); } btw I don’t write ViewModel I write Input … Read more

Difference between Single Responsibility Principle and Separation of Concerns

Single Responsibility Principle (SRP)- give each class just one reason to change; and “Reason to change” == “responsibility”. In example: Invoice class does not have a responsibility to print itself. Separation of Concerns (since 1974). Concern == feature of system. Taking care of each of the concerns: for each one concern, other concerns are irrelevant. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)