views:

57

answers:

1

In active record to write a model you write:

[ActiveRecord("TableName")]
public class Model
{
   [Property("SomeField")]
   public virtual string SomeField { get; set; };

   [Property("SomeLazyField"), Lazy= true]
   public virtual string SomeLazyField { get; set; };

}

If the field is lazy it must fetch it on the first access, so how does the Property attribute override the property and fetches the SomeLazyField value?

A: 

Quoted from Rohan:

I would imagine that AR generates a dynamic proxy and uses interceptors to perform lazy loading. I am not familiar with AR, but have been using Dynamic Proxy and Windsor container for the last year, there are plenty of examples that demonstrate these concepts.

Quoted from Roelof Blom:

Actually it's NH that generates the proxy.

the_drow