Map properties to existing object
See original GitHub issueIs it possible to map properties to an existing object?
For an update operation, i receive a DTO and need to map its properties to a tracked entity from Entity Framework
Sample snippet:
Shop tracked = WriteContext.Shops.Single(s => s.Guid == shopDTO.guid);
tracked.Name = shopDTO.Name;
tracked.Vendor = shopDTO.Vendor;
...
// Todo: map properties in tinymapper
WriteContext.SaveChanges();
It is important to update the properties in the tracked object, otherwise it will not get written to the database.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Automapper: Update property values without creating a ...
I'm seeing that mapping null into an object returns null; whereas in 2.2.1, mapping null into an existing object returned the existing object....
Read more >Object To Object Mapping | Documentation Center | ABP.IO
ABP Framework provides a mapping definition extension to properly map extra properties of two objects.
Read more >Mapping to existing object of same type returns the source ...
Ok, so to use map to auto-assign same properties on destination object of type A from source type A, I can create a...
Read more >Understanding Map and Set Objects in JavaScript
In this article, you will go over the Map and Set objects, what makes them similar or different to Objects and Arrays, the...
Read more >Automapper - Update object ORM
am trying to update an object using telerik openaccess orm and automapper, it works for adding the object to scope but not update....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ohhh, i missed that one. Thank you!
Yes, try to use this method.
public static TTarget Map<TSource, TTarget>(TSource source, TTarget target = default(TTarget))