Closed GoogleCodeExporter closed 9 years ago
Unfortunately, not.
Actually, it can map collections, but it can't map to collection elements.
The `name` attribute must always refer to a field/property in order to read the
required metadata (e.g. PropertyInfo).
A workaround is to use helper as described in XmlMappings, but the drawback is
that you need to introduce mapping concerns into your domain (which is I guess
the reason you would prefer XML mapping instead of metadata)
Original comment by zdeslav....@gmail.com
on 7 Feb 2013 at 11:18
Thanks for the quick reply.
I have one more followup question.
Is it possible to explain the syntax of mapping arrays or collections using
XMLMappings.
Original comment by sharad.y...@gmail.com
on 7 Feb 2013 at 1:59
`name` is a name of collection property on target object (e.g. DTO). it can be
an array, List<> or IList<>. `expression` is an expression evaluated on source
object (e.g. a domain object) which results with a collection object (again an
array or a list). See `ProjectList` in MetadataMappings
lists can be mapped to arrays and other way round. please take a look at unit
tests (e.g. CollectionMappingTest.cs).
It is also possible to map a scalar property on target to an expression, e.g.
map an integer property to the greatest value in the source collection. See
`aggregate functions` in MetadataMappings
Original comment by zdeslav....@gmail.com
on 7 Feb 2013 at 3:06
Original issue reported on code.google.com by
sharad.y...@gmail.com
on 7 Feb 2013 at 2:19