Support 'Expanding' into an existing instance
Closed this issue · 2 comments
We want to create a variation of the expand method that, instead of trying to instantiate a new object to project into, takes an existing one.
This helps the scenario in which we have an existing item and we want to update it with items from the source object. So perhaps you have a Car and a projection that hides the license plate number:
class Car {
public string Color {get; set;}
public string NickName {get; set;}
public string License {get; set;}
}
class EditableCar {
public string Color {get; set;}
public string NickName {get; set;}
}
I may want to get my existing car object, then overlay an EditableCar onto it to overwrite the values as set in EditableCar. So taking:
{
Color:"black",
NickName: "nighthawk",
License: "2AK 8GJ"
}
and expanding the following projection into it
{
Color:"white",
NickName":"dayhawk"
}
would result in
{
Color:"white",
NickName":"dayhawk",
License: "2AK 8GJ"
}
did you want that to function the same as expand with all of the relevant params (source, context, etc.) or simply act as a method on the Expander that allows an object to be projected into another?