pokenae.Commons
1.0.27
dotnet add package pokenae.Commons --version 1.0.27
NuGet\Install-Package pokenae.Commons -Version 1.0.27
<PackageReference Include="pokenae.Commons" Version="1.0.27" />
paket add pokenae.Commons --version 1.0.27
#r "nuget: pokenae.Commons, 1.0.27"
// 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
を実装します。
インフラストラクチャ層
- データベースや外部サービスとの通信を管理します。
- インフラストラクチャ層の
DbContext
はApplicationDbContext
を継承します。 - インフラストラクチャ層のリポジトリの実装は
BaseRepository
を継承します。
マッピング
- 各DTOとエンティティのマッピングを行うmapperは
BaseMappingProfile
を継承します。
フィルタ
pokenae-UserManager(pUM)
を用いた権限管理を行う場合はApiAccessFilter
を有効にします。pUM
を用いてアクセスログ管理を行う場合はLoggingActionFilter
を有効にします。
参照方法
以下の手順に従って、pokenae.Commons
プロジェクトを他のプロジェクトで参照し、利用することができます。
プロジェクト参照の追加:
- Visual Studio 2022で、
pokenae.Commons
プロジェクトを右クリックし、「プロジェクトの依存関係」を選択します。 - 依存関係を追加したいプロジェクトを選択し、「OK」をクリックします。
- Visual Studio 2022で、
NuGetパッケージの復元:
pokenae.Commons
プロジェクトで使用されているNuGetパッケージを復元します。ソリューションエクスプローラーでプロジェクトを右クリックし、「NuGet パッケージの復元」を選択します。
名前空間のインポート:
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 | Versions 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. |
-
net8.0
- AutoMapper (>= 14.0.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Mvc (>= 2.3.0)
- Microsoft.AspNetCore.Routing (>= 2.3.0)
- Microsoft.EntityFrameworkCore (>= 8.0.12)
- Microsoft.EntityFrameworkCore.Abstractions (>= 8.0.12)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.12)
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 |