I’m looking into the UmbracoMapper https://our.umbraco.com/documentation/Reference/Mapping/ (not to be confused with the UmbracoMapper package by Andy Butland of the same name) and wondered if it does any property automapping by convention? It seems that you have to “DefineMaps” for everything?
The docs say “works in ways very similar to AutoMapper” but I can’t get to automatically map properties between source and target of the same name/type.
The analyzer verifies that every publicly settable property of target
is assigned a value. If a property is not assigned a value, the tool
raises a build error (ie. the code will not compile).
Since, contrary to AutoMapper, mapping is not implicit nor automatic,
this ensures that, should a new property be added to ISource, an error
would be raised until the corresponding mappings are updated.
I probably don't understand the advantage/purpose of a mapper that requires you to be explicit about every property mapping. I could write that code without umbracomapper?
Did you find how to map automatically? I'm running into the same exact thing. Which basically does not help. If I'm to fully map my source models to view models, I could be doing it manually in my controllers.
hi Harry - sorry no i didn't find a way to make the umbraco mapper "auto map" but i haven't really revisited this since my post (im trying to remember what i wouldve done, probably just assigned properties manually)
I'm going to bump this question, as I have the same issue.
I want to map an iPublishedContent to a custom model, automatically so items with the same name are mapped. But I don't want to have to define a map for every single time I use the mapper.
built in UmbracoMapper: ability to "auto map"?
Hello
I’m looking into the UmbracoMapper https://our.umbraco.com/documentation/Reference/Mapping/ (not to be confused with the UmbracoMapper package by Andy Butland of the same name) and wondered if it does any property automapping by convention? It seems that you have to “DefineMaps” for everything?
The docs say “works in ways very similar to AutoMapper” but I can’t get to automatically map properties between source and target of the same name/type.
Does it actually automap?
Thanks Andrew
(using umbraco 8.9)
actually, maybe this explains what im asking: (from further down the page https://our.umbraco.com/documentation/Reference/Mapping/)
I probably don't understand the advantage/purpose of a mapper that requires you to be explicit about every property mapping. I could write that code without umbracomapper?
some insight would be appreciated :)
Did you find how to map automatically? I'm running into the same exact thing. Which basically does not help. If I'm to fully map my source models to view models, I could be doing it manually in my controllers.
hi Harry - sorry no i didn't find a way to make the umbraco mapper "auto map" but i haven't really revisited this since my post (im trying to remember what i wouldve done, probably just assigned properties manually)
I'm going to bump this question, as I have the same issue.
I want to map an iPublishedContent to a custom model, automatically so items with the same name are mapped. But I don't want to have to define a map for every single time I use the mapper.
me too i want to mapp the whole class properities instead of one by one
is working on a reply...