title: How do virtual proxies work?
body: <p>I am having some trouble wrapping my head around virtual proxies. I have read tons of articles and spent several hours trying to find good information, but I have yet to find something comprehensive. So I will make a generic request here for better information (either posted here or just a link). I will also add some detail below to better explain what exactly it is I want.</p>
  
  <p>I have several objects and there are many references between them. For the sake of brevity I will have one object (Node) with a basic parent-child relationship. When I pull this object out of the database, I would like to implement lazy-loading. From what I have read, a virtual proxy will essentially handle all the lazy-loading for me by referencing the interface (INode) and pulling data members as needed. [Note: I do not actually have an INode class, but when I put the virtual keyword on my data members, a proxy did seem to be used]</p>
  
  <p>When I make data members in my classes virtual, it seems to make a proxy. Is this a virtual proxy? Do these implement lazy-loading?</p>
  
  <p>I searched for information about the virtual keyword, but the only documentation I could find was to use it on methods, which is used for inheritance so that derived classes can override the function, which has nothing to do with what I want (I think).</p>
  
  <p>This is my current Node.cs</p>
  
  <pre><code>[DataContract(IsReference=true)]
  public partial class Node
  {
    [DataMember]
    public long ID { get; private set; }
    [DataMember]
    public virtual Node Parent { get; set; }
    [DataMember]
    public virtual ICollection&lt;Node&gt; Children { get; set; }
  }
  </code></pre>
  
  <p>Basically at this point I am very confused and just need some guidance on this topic, or even an online resource that I can look to, since all the ones I have found have been less than helpful.</p>
  
  <p>Thanks in advance.</p>