Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIx Issue #537 - Step 4 - Fix MapToTarget behavior From RecordType #766

Closed

Conversation

DocSvartz
Copy link

@DocSvartz DocSvartz commented Jan 23, 2025

before from

record TestRecord()
{
    public int X { set; get; }
}
record TestRecordY() 
{
    public int X { set; get; }
    public int Y { set; get; }
}

var source = new TestRecord() { X= 200};
var dest = new TestRecordY() {X = 100, Y= 500}

var adapt = source.Adapt(dest)  // always adapt == { X=200, Y=0}

after

var adapt = source.Adapt(dest)  // adapt == { X=200, Y=500}  Correct MapTotarget

equal behavior when modified using with

var adapt = dest with {X=source.X};

@DocSvartz
Copy link
Author

DocSvartz commented Jan 23, 2025

@andrerav working on Ctor ignoring I found that MapToTarget was not working for RecordType.
Looks like I missed that in my original solution (
I didn't add test to avoid creating a merge conflict. Although most likely they will be anyway, Sorry

@DocSvartz DocSvartz marked this pull request as ready for review January 23, 2025 16:55
@DocSvartz DocSvartz requested a review from andrerav January 23, 2025 16:55
@DocSvartz
Copy link
Author

@andrerav It also looks like this case is also not working correctly from Record (When using Ignore())

var adapt = dest with { };

I will add a separate PR after the final decision on the possibility of calling Ctor with default value.
I still need to figure out how to combine it. )

@DocSvartz DocSvartz changed the title Fix MapToTarget behavior From RecordType FIx Issue #537 - Step 4 - Fix MapToTarget behavior From RecordType Jan 24, 2025
@DocSvartz DocSvartz requested review from andrerav and removed request for andrerav January 25, 2025 05:37
@DocSvartz DocSvartz marked this pull request as draft January 25, 2025 06:13
@DocSvartz DocSvartz closed this Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant