Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6018567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:17:37+00:00 2026-05-23T03:17:37+00:00

I am having some trouble wrapping my head around virtual proxies. I have read

  • 0

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.

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]

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?

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).

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 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.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:17:38+00:00Added an answer on May 23, 2026 at 3:17 am

    “Virtual” proxy and lazy loading is something related to ORM tools. The proxy actually is not virtual it is dynamic and it follows real Proxy pattern defined by GoF.

    Dynamic proxy is class created by ORM tool at runtime (it is not defined as a code file anywhere). It derives from your entity and it overrides navigation properties. Because of that they must be virtual to make a proxy work. The proxy holds a state of navigation property in private field or any more complex structure and if the property is accessed first time it sees that the state is unloaded and triggers loading from database and change the state to loaded.

    Anyway I’m not sure how this refers to WCF because best practice is not using lazy loading with WCF. Why?

    • If you use lazy loading on server side serialization will always pull from database whole object graph because serialization will access every navigation property and triggers lazy loading but it will then start serializing lazy loaded entities and access all their navigation properties, etc.
    • Lazy loading on client side is something blured. First of all lazy loading on client side is completely up to you – you must implement it. When using services you should always follow one of SOA tenets: Service boundary is explicit. It means that user of your object should always know that he is doing remote call instead of local call. Main target in distributed computing is reducing network roundtrips so you should use eager loading and transfer all needed data in a single roundtrip if possible instead of using deferred loading. The same is applicable for loading from database – use lazy loading when it make sense because roundrips to database can be costly operations.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble wrapping my head around this one. I have a
I am having some trouble wrapping my head around this function: var toStr =
I'm having trouble wrapping my head around this, and would love some guidance. I
I'm having trouble wrapping my head around a query. I have the following 3
I'm having some troubles wrapping my head around lxml. I have some html I
I am currently having some trouble wrapping my head around this issue. I had
I am having some trouble wrapping my head around noexcept. template <int SIZE> int
I'm new to backbone.js and having some trouble wrapping my head around an issue
I still have some trouble wrapping my head around threads, and I'm trying to
I'm having some troubles wrapping my head around how to go about parsing some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.