Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WPF Prism Full App 軽量DDD

Posted at

はじめに

「ドメイン駆動設計入門」を読んだ

プロジェクトの構成(どこに何を置くべきか)について少しわかった気になっている

WPFのフレームワークであるPrismが提供しているフルテンプレートに
ドメイン駆動の部品たちを追加し、軽量DDDをしてみようとして
"モジュール"の存在の前に挫折した記録

プロジェクト作成

Visual Studioを立ち上げて、Prsim Full App(.NET Core) を選択する

  • 初期のモジュールがModuleNameという名前なので、ModuleAに変更しておく
  • RegionViewModelBaseは、それ単体で使うことがないので、抽象クラスに変更する

テンプレートに追加する項目

FullApp.Core

追加項目 内容
DialogViewModelBase ダイアログはこのクラスを継承する
DialogNames ハードコーディングを避けるために、自作したダイアログの名前を

FullApp.Services.Interfaces

追加項目 内容
IFullAppRepository データを再構築・永続化するリポジトリのインターフェイス

FullApp.Repositories

追加項目 内容
EFInfrastructure Entity FrameworkをつかってDBにアクセスする場合の実装
InMemoryInfrastructure テスト時に疑似DBとしてつかう

SnsApplication

解決したい課題に対するユースケースを実現する

モジュールにロジックは書く?

結論
モジュールにロジックを書いてもいい

Prism公式サイトのモジュールの説明より抜粋
※印は注釈としてあとから付けたもの

A client module encapsulates a portion of the application's overall functionality and typically represents a set of related concerns.

クライアントモジュールは

  • アプリ全体の機能の一部をカプセル化する
  • 関連する関心事を表す

It can include a collection of related components, such as application features, including user interface and business logic, or pieces of application infrastructure, such as application-level services for logging or authenticating users.

さらにクライアントモジュールは、関連するコンポーネント群を含むことができる

  • アプリケーション機能
    • ユーザーインターフェース(※Viewのこと)
    • ビジネスロジック(※ドメインのルール)
  • アプリケーションのインフラ
    • ロギングサービス
    • ユーザ認証サービス

Modules are independent of one another but can communicate with each other in a loosely coupled fashion.

モジュールは互いに独立しているが、疎結合で互いに通信することもできる
(※あくまで依存せずにメッセージを送りあうというイメージか?)

Using a modular application design makes it easier for you to develop, test, deploy, and maintain your application.

モジュール化されたアプリは開発・テスト・デプロイ・保守を容易にする

おわりに

モジュールがいることで、わたしの中のDDDが一歩遠のいた
モジュールの立ち位置がわからない

PRISMライブラリを使いこなすことはできないのだろうか・・・

END

参考

WPFといえばこの御仁

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?