I'd like to define maps for my entities to my view model objects in ASP.NET MVC - and have DO implicitly include the required fields as a prefetch.

For example, assume I have a Customer entity with a Name (string) and BillingAddress (Address entity). I have a CustomerViewModel object with Name and City properties... and I'd like Customer.Name and Customer.BillingAddress.City to map to the view model's properties, respectively.

Will DO include BillingAddress and the necessary fields in a prefetch, so that this can be accomplished with one query (or at least one trip to the DB)?


Finally, is there any formal documentation on the mapper? I don't even know how to get starting with mapping.

asked Feb 18 '11 at 19:56

ara's gravatar image


edited Feb 18 '11 at 19:57

Just figured out the basics of the mapper.

Unfortunately, seems like it does not prefetch.

(Feb 18 '11 at 21:56) ara ara's gravatar image

One Answer:

True, O2O mapper isn't responsible for prefetch at all. If you'd like to ensure something is prefetched, you should do this prior to transformation - by either using prefetch API, or by running the queries directly.

Possibly future version of this API will support automatic prefetches.

answered Feb 20 '11 at 05:27

Alex%20Yakunin's gravatar image

Alex Yakunin

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA