Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Improvement] - Add by default using optimum constructor selector to unify the choice of constructor for types

オープン
#892 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
csharp
領域
backend

調査の方向性

まず、Mapster のソースでコンストラクター選択と MappingScore のロジックを見つけます。payload では特定のファイルやテストは指定されていません。示されている score、パラメーター数、最初の一致を優先するタイブレークのルールを対象とした集中的なカバレッジを追加し、提供されたコンストラクターの例がドキュメントに記載されたコンストラクターを選択したら完了とみなします。

索引モデルが issue の本文から書いたものです。

説明

improvement

Since the restriction of having a default constructor new() for classes is no longer mandatory,
and the constructor can using default values ​​for the parameter type.

Optimality criterion(MappingScore) = maximum count of not mapped params. (MappingParam - CountParam)
If any constructors have the same MappingScore, select the one with more parameters.

Edge case: If any constructors have the same equal MappingScore and equal count of params select first.

Example:


Source
{
	A 
}

Destination
{
	new ()     // MappingScore = 0; ParamCount = 0;
	new (A)  // MappingScore  = 0; ParamCount = 1; <- select this max Param
}

Destination
{
	new ()         // MappingScore = 0; ParamCount = 0; <- select this max MappingScore 
	new (A,В)   // MappingScore  = -1; ParamCount = 1; 
}

Destination
{
	new (A)       // MappingScore = 0; ParamCount = 0; <- select this max MappingScore 
	new (A,В)    // MappingScore  = -1; ParamCount = 2; 
}

Edge case:


Destination
{
	new (A,B)     // MappingScore = -1; ParamCount = 1; <- select this max MappingScore 
	new (A,C)    // MappingScore  = -1; ParamCount = 1; 
}

主要言語
C#
スター
5.2k
フォーク
411
平均マージ
1日 8時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MapsterMapper/Mapster のほかの issue

MapsterMapper/Mapster の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。