Exception occured when map single object from EF Core entity class (with proxy)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Start by tracing how Mapster resolves the runtime source type in Adapt<CreateApiRequest>(), comparing it with the explicit-source-type overload that succeeds. Reproduce the failure with an EF Core lazy-loading proxy and check the existing mapping tests for proxy or derived types. Done when mapping the proxy without an explicit source type succeeds while the destination-member validation remains correct.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi, i'm using Mapster ver. 10.0.11, i got exception when doing single object mapping
The following members of destination class CreateApiRequest do not have a corresponding source member mapped or ignored: ...
which i have include described field in mapster config and passed TypeAdapterConfig.GlobalSettings.Compile();.
My code when call adapt:
var entity = getEntityById(id); //EF Core entity
var mapped = entity.Adapt<CreateApiRequest>(); //map with mapster, got exception here, compile is ok
As i investigated, it turns out that entity type is Proxy rather than actual type (i'm using EF LazyLoadingProxies).
Current workaround that i'm using is to specify source type when mapping:
var mapped = entity.Adapt<EntityType, CreateApiRequest>(); //this line successfully run
- 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
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MapsterMapper/Mapster
-
.NET MatrixĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MapsterMapper/Mapster#1003 ·
-
[Mapster Tool] Add support for global:: to disambiguate type names in generated mappersCó thể đã có người làm @DocSvartz đã nhận 1 ngày trước. Đang mởimprovement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
MapsterMapper/Mapster#1020 · 3 bình luận ·
-
Mapster.Tool - PropertySettingBuilder.Map(member, mapFunc, targetPropertyName) method is not working as expected!Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
MapsterMapper/Mapster#1017 · 6 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
MapsterMapper/Mapster#1007 · 5 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
MapsterMapper/Mapster#1005 ·
Tất cả issue của MapsterMapper/Mapster
Issue tương tự
-
bug priority: P2
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Docs] README/PRIVACY still name AppCenter although v1.5.6.0+ uses the Microsoft Store Services SDKĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/azure-sdk-tools#17317 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày