「アプリケーション層」(リクエストコントローラーを含む)、「インフラストラクチャー層クラス」(データベースアクセサーを担当)をインスタンス化し、「ドメインロジック層サービス」をインスタンス化して、最後に述べたインフラストラクチャークラスを注入します。
そのため、責任のあるクラスが注入されるため、ドメイン ロジックはデータベースへのアクセス方法に依存しません。
アプリケーション層は、最終的な応答を提供します。例:
## router dispatch to this controller function
def mycontroller(price):
product_repository = infrastructure_layer.mysql_product_repository()
products = domain_layer.get_all_products(price, product_repository)
return JsonResponse(products.to_string()) ## framework returns the response to the client
これはどのようなアーキテクチャのようですか?タマネギのアーキテクチャなどですか?
ありがとう!