﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on A guide into OR/M implementation challenges: Lazy loading</title><description>Mats,
  
Oh, in that case, you don't have to worry about this at all. 
  
NH manages proxy instances in a different manner. You just use the Interceptor.Instansiate to make sure that you give NH an instance with the right proxy, and there are no issues there.
</description><link>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment5</link><guid>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment5</guid><pubDate>Sun, 30 Aug 2009 06:51:57 GMT</pubDate></item><item><title>Mats Helander commented on A guide into OR/M implementation challenges: Lazy loading</title><description>"That is why NH says that entities SHOULD provide Equals impl."
  
  
Ah, right - forgot about that!
  
  
"But I don't see why you need downcasting in aspect code"
  
  
well, an example could be an aspect that presents something, say a Product, as Html and that in the presentation method goes on to try to downcast the product to a few known subtypes, such as Book and DVD, to present particular information about these. Standard OO might suggest that using polymorphism would be the way to go for this type of thing, but OTOH at some point overloading objects with too many responsibilities is a problem of its own. Mapping to a presentation model is a possibility, but using aspects and a little downcasting can be another, admittedly not as clean, but sometimes more practical solution. Especially if it is easier to come over a good AOP framework than a good O/O Mapping framework to map between the presentation model and the domain model. 
  
  
</description><link>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment4</link><guid>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment4</guid><pubDate>Sun, 30 Aug 2009 00:29:29 GMT</pubDate></item><item><title>Ayende Rahien commented on A guide into OR/M implementation challenges: Lazy loading</title><description>Mats,
  
instance references comparisons would fail, yes. That is why NH says that entities SHOULD provide Equals impl.
  
It is also called the leaking this issue.
  
  
As for downcasting, there are ways to get the actual unproxied instance, you just need to be aware of that. But I don't see why you need downcasting in aspect code.
</description><link>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment3</link><guid>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment3</guid><pubDate>Sat, 29 Aug 2009 07:28:26 GMT</pubDate></item><item><title>Mats Helander commented on A guide into OR/M implementation challenges: Lazy loading</title><description>So...this means that if someone has a direct reference to the Dog, doing an instance equality comparison between that Dog and the object returned by the Animal property will fail? 
  
  
And downcasting is reality for a lot of aspect code, while I know why we should strive to avoid downcasting code and use polymorphism instead whenever possible, it is not always practical...so making that more cumbersome can hardly be thought of as a benefit, right? :-P
</description><link>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment2</link><guid>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment2</guid><pubDate>Fri, 28 Aug 2009 22:45:50 GMT</pubDate></item><item><title>Nicholas Blumhardt commented on A guide into OR/M implementation challenges: Lazy loading</title><description>And best of all, the NHibernate approach makes you work harder to eliminate down-casting in your design :)
</description><link>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment1</link><guid>http://ayende.com/4152/a-guide-into-or-m-implementation-challenges-lazy-loading#comment1</guid><pubDate>Fri, 28 Aug 2009 21:19:15 GMT</pubDate></item></channel></rss>