Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

wish to add the ability to ignore a copy of a property when it has a specific value. For example, null, empty string, empty collection

Đang mở
#747 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
csharp
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu bằng việc xem xét hành vi hiện có của Mapster trong việc không sao chép các thuộc tính null và API IgnoreMember được nêu trong issue. Xác định cách các giá trị được cấu hình như null, chuỗi rỗng và collection rỗng sẽ ảnh hưởng đến việc sao chép, sau đó xác minh hành vi bằng các trường hợp mapping bao quát các giá trị được yêu cầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Ignore features improvement waiting for info

mapster has provided the function of not copying the property when the value of the property is null. Can we extend this function to stop copying the property when the value of the property is a series of specific values? It is better to provide a general method (I am not sure which property and which type, but I am sure that the value cannot be these)? Determine whether a property field can be copied before it is copied

  // Can you provide such a method     
  //      Another framework, automapper, already provides similar functionality
  // I don't care about the attribute name, but I care about the attribute value, and providing the attribute name is best when determining the attribute value
  IgnoreMember((srcMember, destMember, srcValue, destValue) =>
  {
      if (srcValue is string srcValueTxt)
      {
          return string.IsNullOrWhiteSpace(srcValueTxt);
      }

      if (srcValue == destValue)
      {
          return true;
      }

      return false;
  })
Ngôn ngữ chính
C#
Star
5.2k
Fork
409
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của MapsterMapper/Mapster

Tất cả issue của MapsterMapper/Mapster

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.