iconDreamine
← 지식 Q&A 목록
Command · Published

[DreamineCommand]를 붙이면 어떤 Command가 자동으로 만들어지나요?

요청 판정 Supported 개정 1 / 1 조회 637초 동안 분석2026-07-20 23:26
직접 답변

`[DreamineCommand]`를 붙인 매개변수 없는 partial 메서드는 기본적으로 `{메서드명}Command`라는 실행 명령으로 생성됩니다. 예를 들어 `Increment()`에는 `IncrementCommand`, `Toggle()`에는 `ToggleCommand`가 만들어집니다.

핵심 코드 근거

직접 근거

CounterViewModel의 Increment 명령 선언 코드 선언

매개변수 없는 `Increment` partial 메서드에 `DreamineCommand("Event.Increment")`가 적용되어 있습니다.

[DreamineCommand("Event.Increment")] private partial void Increment();
    /// \endif
    /// \if EN
    /// <para>Performs the increment operation.</para>
    /// \endif
    /// </summary>
    [DreamineCommand("Event.Increment")]
    private partial void Increment();

    /// <summary>
    /// \if KO
    /// <para>Reset 작업을 수행합니다.</para>
    /// \endif
    /// \if EN
20_SOURCES/998. DEMO/000. Sample/050. CrossUi/SampleCrossUi.Shared/ViewModels/CounterViewModel.cs:52-64
직접 근거

Event 계층의 역할 코드 선언

ViewModel은 DreamineCommand를 통해 호출만 하고 실제 동작은 Event 클래스가 처리한다고 설명합니다.

public sealed class CounterEvent

namespace SampleCrossUi.Shared.ViewModels;

/// <summary>
/// \if KO
/// <para>Counter 화면의 실제 동작(증가/리셋/로그 기록)을 처리합니다. CounterViewModel은 [DreamineCommand]를 통해 이 클래스의 메서드를 호출만 합니다.</para>
/// \endif
/// \if EN
/// <para>Encapsulates counter event functionality and related state.</para>
/// \endif
/// </summary>
public sealed class CounterEvent
{
20_SOURCES/998. DEMO/000. Sample/050. CrossUi/SampleCrossUi.Shared/ViewModels/CounterEvent.cs:5-17
직접 근거

LightBulbViewModel의 Toggle 선언 코드 선언

`Toggle` 메서드가 `Event.Toggle`로 전달되도록 선언되어 있습니다.

[DreamineCommand("Event.Toggle")] private partial void Toggle();
    /// \endif
    /// \if EN
    /// <para>Performs the toggle operation.</para>
    /// \endif
    /// </summary>
    [DreamineCommand("Event.Toggle")]
    private partial void Toggle();

    /// <summary>
    /// \if KO
    /// <para>지정한 설정으로 <see cref="LightBulbViewModel"/> 클래스의 새 인스턴스를 초기화합니다.</para>
    /// \endif
    /// \if EN
20_SOURCES/998. DEMO/000. Sample/050. CrossUi/SampleCrossUi.Shared/ViewModels/LightBulbViewModel.cs:67-79
직접 근거

매개변수 Command 직접 작성 사례 코드 선언

`RelayCommand<string>`은 DreamineCommand로 생성할 수 없어 직접 작성한다고 명시합니다.

public RelayCommand<string> SelectRadioCommand { get; }
    /// </summary>
    public string SelectedRadio => Event.SelectedRadio;

    /// <summary>
    /// \if KO
    /// <para>RelayCommand&lt;string&gt;는 매개변수가 있어 [DreamineCommand]로 생성할 수 없어 직접 작성한다.</para>
    /// \endif
    /// \if EN
    /// <para>Gets the select radio command value.</para>
    /// \endif
    /// </summary>
    public RelayCommand<string> SelectRadioCommand { get; }
20_SOURCES/998. DEMO/000. Sample/050. CrossUi/SampleCrossUi.Shared/ViewModels/ControlsViewModel.cs:235-247

추가 설명

제약과 배치 가이드

이 저장소 예제에서는 매개변수가 필요한 `RelayCommand<string>`은 `[DreamineCommand]`로 생성하지 않고 `SelectRadioCommand`를 직접 작성합니다. ViewModel에는 `[DreamineCommand("Event.메서드")]` 형태의 전달 선언을 두고, 실제 동작은 `Event` 클래스에 배치하는 구조입니다.

확인되지 않은 내용

  • 추가 저장소 검색은 실행 환경 오류로 수행되지 않았습니다. 기본 이름 규칙은 제공된 선언·호출 사례로 확인했지만, 생성기 구현 자체의 정확한 이름 조합 코드는 확인하지 못했습니다.
기술 세부정보

정규화된 질문: [DreamineCommand]를 붙이면 어떤 Command가 자동으로 만들어지나요?

Source · CounterViewModel의 Increment 명령 선언 source-1 · 직접 근거 · confidence 1.00
Source · MAUI에서 생성된 IncrementCommand 사용 source-2 · 직접 근거 · confidence 1.00
Source · RelayCommand 생성기 규칙 source-3 · 직접 근거 · confidence 1.00
Source · LightBulbViewModel의 Toggle 선언 source-4 · 직접 근거 · confidence 1.00
Source · MAUI에서 생성된 ToggleCommand 사용 source-5 · 직접 근거 · confidence 1.00
Source · 매개변수 Command 직접 작성 사례 source-6 · 직접 근거 · confidence 1.00
Source · Event 계층의 역할 source-7 · 직접 근거 · confidence 1.00
검색 원본
서버 저장소 소스 코드
생성 모델
codex-cli:default
생성 정책
dreamine-repository-search-v4
마지막 검증
2026-07-20 23:26:31
이 답변이 유용했나요?