|
-
Jan 6th, 2007, 12:58 PM
#1
Thread Starter
New Member
Object Factories with Lazy Loading in C#
I'm looking for a lazy loading solution in c#.
The idea is, to have a kind of object factory, which will be responsible for creating my entity objects.
When a property of such an object is accesed and it is not yet loaded, the factory
(or a magic watcher) will be able to pause the execution flow for a while (maybe that step is not necessary)
load the missing data (don't know how to specify, from where to load that data----maybe via attributes) and
return to the flow.
My entity objects, do not have a possibility to load the missing data by themselves, because they
are only data containers having private members, which are accessible via public properties.
These objects need to be filled with their data from outside, and therefore many lazy loading solutions
won't work here.
Maybe anyone of you knows the solution for my problem?
Thank You in advance!
Greetz!
cyberjoe
-
Jan 9th, 2007, 11:50 AM
#2
Re: Object Factories with Lazy Loading in C#
Create public properties in your class. When this property is accessed, if the corresponding private variable is null, make a call to the private method that can do the fetching for you. Populate the private member, return it.
Those are the basics. If this isn't what you want, explain 'These objects need to be filled with their data from outside'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|