Is there a way to override the need for a public constructor for the mapping to work? Our objects are part of an API, and the base constructor requires that the record id be given.
Asked
Active
Viewed 429 times
2
-
It requires ID to be passed. May i know why you want to avoid that behavior – Ashley John Aug 24 '11 at 13:36
-
It is part of a piece that stops consumers of the API from changing the entity record id directly. – Omnia9 Aug 24 '11 at 14:49
-
3See this question: http://stackoverflow.com/questions/2239143/automapper-how-to-map-to-constructor-parameters-instead-of-property-setters – Jonas Høgh Aug 24 '11 at 14:58
-
1So where would the ID come from instead? Is it already on an existing object? – Jimmy Bogard Aug 24 '11 at 20:30
-
@Jonas H: That was what i was looking for. http://stackoverflow.com/questions/2239143/automapper-how-to-map-to-constructor-parameters-instead-of-property-setters – Omnia9 Aug 25 '11 at 11:46
-
This post reference from @Jonas H gave me what i needed. http://stackoverflow.com/questions/2239143/automapper-how-to-map-to-constructor-parameters-instead-of-property-setters – Omnia9 Sep 04 '11 at 21:49