command-pattern

CQRS: Command Return Values [closed]

旧城冷巷雨未停 提交于 2020-07-16 11:00:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . Improve this question There seems to be endless confusion about whether commands should or should not have return values. I would like to know if the confusion is simply because the participants have not stated their context or circumstances. The Confusion Here are examples

AppCommand are not supported in a Windows Presentation Foundation (WPF) project

核能气质少年 提交于 2020-01-17 05:21:10
问题 I am trying to run the code from the question "Understanding ICommand implementation without MVVM" in VS2012 (Window 7) but getting errors: "AppCommand are not supported in a Windows Presentation Foundation (WPF) project" Well, what is wrong or what should I do in order to run the code from that question? MainWindow.xaml.cs: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data;

How to inject an action into a command using Ninject?

孤人 提交于 2020-01-06 19:34:11
问题 Actually exploring the Command Pattern and finds it pretty interesting. I'm writing a WPF Windows App following the MVVM Architectural Pattern. I've begun with these post which explain the basics. Basic MVVM and ICommand usuage example Simplify Distributed System Design Using the Command Pattern, MSMQ, and .NET Now that I was able to break user actions into commands, I thought this could be great to inject the commands that I want. I noticed that the commands are found into the ViewModel in

How to inject an action into a command using Ninject?

空扰寡人 提交于 2020-01-06 19:34:01
问题 Actually exploring the Command Pattern and finds it pretty interesting. I'm writing a WPF Windows App following the MVVM Architectural Pattern. I've begun with these post which explain the basics. Basic MVVM and ICommand usuage example Simplify Distributed System Design Using the Command Pattern, MSMQ, and .NET Now that I was able to break user actions into commands, I thought this could be great to inject the commands that I want. I noticed that the commands are found into the ViewModel in

Reuse code for looping through multidimensional-array

时光毁灭记忆、已成空白 提交于 2020-01-04 06:36:08
问题 Let's say I have a multi-dimensional array as a member of a class and a lot of methods, that loop through every element of the array and then operate on it. The code might look like this: public class Baz { private Foo[][] fooArray = new Foo[100][100]; public Baz() { for (int i = 0; i < fooArray.length; i++) { for (int j = 0; j < fooArray[i].length; j++) { // Initialize fooArray } } } public void method1() { for (int i = 0; i < fooArray.length; i++) { for (int j = 0; j < fooArray[i].length; j

How can I write this class to be fully generic and return different responses according to one request?

坚强是说给别人听的谎言 提交于 2020-01-04 04:54:10
问题 I was asked to create a series of reports for an application and as always, I'm looking for ways to reduce the amount of code written. I've started trying to come up with the easiest way to request a single report. Here's what I imagined: var response = ReportGenerator.Generate(Reports.Report1); //Reports would be an enum type with all of the available reports. As soon as I tried to design that, the problems appeared. Every report has a different input and output. The input being the entity

Real world example of application of the command pattern

ぃ、小莉子 提交于 2020-01-01 04:40:09
问题 Command pattern can be used to implement Transactional behavior (and Undo ). But I could not find an example of these by googling. I could only find some trivial examples of a lamp that is switched on or off . Where can I find a coding example (preferably in Java )of this/these behaviors implemented using the Command Pattern ? 回答1: In one of our projects, we have the following requirement: Create a record in DB. Call a service to update a related record. Call another service to log a ticket.

Command Pattern Usefulness when using JComponents

我的未来我决定 提交于 2019-12-29 07:06:13
问题 So, I'm developing a program using the Swing library and I obviously have buttons and menu items. Some of these are supposed to do the same stuff, and I thought using the Command Pattern should be the way to do it, e.g. I have a "save" button and a "save" menu item and they have to implement the same saving algorithm. Command Pattern seems to be ok but I can't get who's the receiver in all that. Isn't a comand supposed to work on an object which implements some sort of "receiver interface",

Understanding ICommand implementation without MVVM

泪湿孤枕 提交于 2019-12-24 03:17:10
问题 I am trying to understand how to work with Commands. I read a lot about commands, and I know, that most times commands are used within the MVVM pattern. Also I know, that there is a RoutedCommand class - which is often used to save time while developing. But - I want to understand the basics - and exactly that's the problem. Here we go: In my app I defined a class 'MyCommand' : public class MyCommand :ICommand { public void Execute(object parameter) { Console.WriteLine("Execute called!");