pokenae.Commons 1.0.27

dotnet add package pokenae.Commons --version 1.0.27                
NuGet\Install-Package pokenae.Commons -Version 1.0.27                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="pokenae.Commons" Version="1.0.27" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pokenae.Commons --version 1.0.27                
#r "nuget: pokenae.Commons, 1.0.27"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install pokenae.Commons as a Cake Addin
#addin nuget:?package=pokenae.Commons&version=1.0.27

// Install pokenae.Commons as a Cake Tool
#tool nuget:?package=pokenae.Commons&version=1.0.27                

pokenae.Commons

概要

pokenae.Commonsプロジェクトは、共通のサービス、リポジトリ、エンティティ、DTO、マッピングプロファイル、データベースコンテキスト、フィルタなどを提供します。このプロジェクトは、他のプロジェクトで再利用可能な汎用的な機能を提供することを目的としています。

本プロジェクトはプレゼンテーション層、アプリケーション層、ドメイン層、インフラストラクチャ層の4層で構成されるポケなえのプロジェクトを支援するものです。

各層の責務

プレゼンテーション層

  • ユーザーインターフェースを提供し、ユーザーからの入力を受け付けます。
  • アプリケーション層のDTOを使用してデータを表示します。

アプリケーション層

  • ビジネスロジックを実行し、プレゼンテーション層とドメイン層の間のデータの移動を管理します。
  • アプリケーション層のDTOは、アプリケーション層からプレゼンテーション層へのデータの移動を行い、ApplicationDtoを継承します。

ドメイン層

  • ビジネスルールとビジネスロジックを実現します。
  • ドメイン層のエンティティはBaseEntityを継承します。
  • ドメイン層のValueObjectはBaseValueObjectを継承します。
  • ドメイン層のサービスはビジネスルール、ビジネスロジックを実現するためのメインのサービスとリポジトリと1:1で存在するサブサービスで構成され、サブサービスのインターフェースはIRepositoryServiceを実装し、その実装はRepositoryServiceを継承します。
  • ドメイン層のDTOはインフラストラクチャ層からドメイン層へのデータの移動を行い、InfrastructureDtoを継承します。
  • ドメイン層のリポジトリはDBテーブルなどと1:1で存在し、IBaseRepositoryを実装します。

インフラストラクチャ層

  • データベースや外部サービスとの通信を管理します。
  • インフラストラクチャ層のDbContextApplicationDbContextを継承します。
  • インフラストラクチャ層のリポジトリの実装はBaseRepositoryを継承します。

マッピング

  • 各DTOとエンティティのマッピングを行うmapperはBaseMappingProfileを継承します。

フィルタ

  • pokenae-UserManager(pUM)を用いた権限管理を行う場合はApiAccessFilterを有効にします。
  • pUMを用いてアクセスログ管理を行う場合はLoggingActionFilterを有効にします。

参照方法

以下の手順に従って、pokenae.Commonsプロジェクトを他のプロジェクトで参照し、利用することができます。

  1. プロジェクト参照の追加:

    • Visual Studio 2022で、pokenae.Commonsプロジェクトを右クリックし、「プロジェクトの依存関係」を選択します。
    • 依存関係を追加したいプロジェクトを選択し、「OK」をクリックします。
  2. NuGetパッケージの復元:

    • pokenae.Commonsプロジェクトで使用されているNuGetパッケージを復元します。ソリューションエクスプローラーでプロジェクトを右クリックし、「NuGet パッケージの復元」を選択します。
  3. 名前空間のインポート:

    • pokenae.Commonsプロジェクトのクラスやインターフェースを使用するために、必要な名前空間をインポートします。例えば、以下のようにインポートします。

    • using pokenae.Commons.Filters; using pokenae.Commons.Data; using pokenae.Commons.DTOs; using pokenae.Commons.Entities; using pokenae.Commons.Mappings; using pokenae.Commons.Repositories; using pokenae.Commons.Repositories.impl; using pokenae.Commons.Services.Application; using pokenae.Commons.Services.Application.impl;

命名規約

ドメイン層のDTO、リポジトリ、リポジトリと1:1の関係にあるサブサービス

  • マスタテーブル:

    • 接頭語: M1
    • : M1CustomerRepository, M1ProductRepository, M1CustomerDto, M1CustomerService
  • トランザクションテーブル:

    • 接頭語: T1
    • : T1OrderRepository, T1InvoiceRepository, T1OrderDto, T1OrderService
  • ログテーブル:

    • 接頭語: L1
    • : L1ErrorLogRepository, L1AccessLogRepository, L1ErrorLogDto, L1ErrorLogService
  • 設定テーブル:

    • 接頭語: C1(Configurationの略)
    • : C1AppSettingsRepository, C1UserSettingsRepository, C1AppSettingsDto, C1AppSettingsService
  • 参照テーブル:

    • 接頭語: R1(Referenceの略)
    • : R1CountryRepository, R1CurrencyRepository, R1CountryDto, R1CountryService
  • 履歴テーブル:

    • 接頭語: H1(Historyの略)
    • : H1OrderHistoryRepository, H1LoginHistoryRepository, H1OrderHistoryDto, H1OrderHistoryService
  • 一時テーブル:

    • 接頭語: T2(Temporaryの略)
    • : T2TempDataRepository, T2SessionDataRepository, T2TempDataDto, T2TempDataService
  • キュー:

    • 接頭語: Q1(Queueの略)
    • : Q1MessageQueueRepository, Q1TaskQueueRepository, Q1MessageQueueDto, Q1MessageQueueService
  • 外部API:

    • 接頭語: E1(Externalの略)
    • : E1GoogleApiRepository, E1TwitterApiRepository, E1GoogleApiDto, E1GoogleApiService

サービスの命名規約

  • ドメイン層のサービス:

    • 接尾語: Service
    • : CustomerService, OrderService
  • アプリケーション層のサービス:

    • 接尾語: UseCase
    • : CreateOrderUseCase, GetCustomerDetailsUseCase

まとめ

pokenae.Commonsプロジェクトは、共通の機能を提供することで、他のプロジェクトでのコードの再利用性を高め、開発効率を向上させることを目的としています。各クラスやインターフェースを適切に参照し、利用することで、共通のビジネスロジックやデータ操作を簡単に実装することができます。

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.27 57 3/22/2025
1.0.26 55 3/21/2025
1.0.25 122 3/21/2025
1.0.24 125 3/20/2025
1.0.23 122 3/20/2025
1.0.22 124 3/20/2025
1.0.21 123 3/20/2025
1.0.20 128 3/19/2025
1.0.19 127 3/16/2025
1.0.18 126 3/16/2025
1.0.17 123 3/16/2025
1.0.16 118 3/16/2025
1.0.15 133 3/16/2025
1.0.14 119 3/16/2025
1.0.13 115 3/16/2025
1.0.12 124 3/16/2025
1.0.11 117 3/16/2025
1.0.10 117 3/15/2025
1.0.9 56 3/15/2025
1.0.8 192 3/6/2025
1.0.7 190 3/6/2025
1.0.6 193 3/6/2025
1.0.5 196 3/6/2025
1.0.4 187 3/6/2025
1.0.3 184 3/6/2025
1.0.2 184 3/6/2025
1.0.1 199 3/6/2025
1.0.0 192 3/6/2025