I'm having trouble moving my head around virtual proxies. I read many articles and spent several hours trying to find good information, but I still have to find something comprehensive. Therefore, I will make a general request here to get more accurate information (either posted here, or just a link). I will also add some details below to better explain what exactly I want.
I have several objects and there are many links between them. For brevity, I will have one object (Node) with basic parent-child relationships. When I pull this object out of the database, I would like to implement lazy loading. From what I read, the virtual proxy will essentially handle all the lazy loading for me, referring to the interface (INode) and pulling the data items as needed. [Note. I donβt actually have an INode class, but when I put the virtual keyword in my data, maybe a proxy was used]
When I make data members in my classes virtual, it seems to make proxies. Is this a virtual proxy? Do they do lazy loading?
I was looking for information about the virtual keyword, but the only documentation I could find was to use it in the methods that are used for inheritance so that derived classes could override a function that has nothing to do with what I want ( I think).
This is my current Node.cs
[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<Node> Children { get; set; } }
Basically, at this moment I am very confused and I just need to be guided by this topic or even an online resource that I can look at, since everything I found was less useful.
Thanks in advance.
source share