AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

CSLA - Implement a ChildLoader to facilitate Silverlight lazy loading #470

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In order to support lazy loading in Silverlight, we need to implement a class 
that can load a child object directly for us, as described by Rocky here:

http://www.lhotka.net/weblog/LazyLoadingChildrenInCSLA4AndSilverlight.aspx

I have updated the templates to incorporate this functionality.  I have added a 
generic class called AsyncChildLoader and put it in the Utility folder.  This 
class is required on both the .NET and Silverlight side.  I also made changes 
to the async factory methods so that they can use this class to directly load 
children.

Original issue reported on code.google.com by RoyMunso...@gmail.com on 28 Jul 2010 at 10:40

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,

I looked over that post, I didn't think the ChildLoader class is required. I 
should be doing the same exact thing minus the one class.

Also that patch is not from the latest version and the Async Loader class is 
not included. Do you have a sample that I can run to take a look at the current 
implementation? Possibly update our Petshop sample application?

I did notice from this patch that some of the factory methods had been using 
the business class name instead of the child's.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 29 Jul 2010 at 7:46

GoogleCodeExporter commented 9 years ago
The templates didn't work as they were.  CSLA would throw an exception saying 
that it couldn't call DataPortal_Fetch, which was true because the child 
objects don't have one, they have Child_Fetch, hence the need for a 
ChildLoader.  It looks like somebody already realized this, as they put the 
following comments in there:

// How should this be called? In the sync method we call FetchChild.

Is there another way to call FetchChild asynchronously?

Original comment by RoyMunso...@gmail.com on 29 Jul 2010 at 8:10

GoogleCodeExporter commented 9 years ago
Hello,

Hehe, that was my comments. Is there anyway you could attach the patch with the 
child loader class. Also can you review the changes to the ChildBusinessName 
being replaced with the BusinessName.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 30 Jul 2010 at 11:59

GoogleCodeExporter commented 9 years ago
I figured out what I did wrong with the SVN patch.  I'll send you another one 
including the new class and patched against the latest version.  I'm also 
setting up a lazy loading SL sample in the Petshop app.  I'll send you that as 
well.  I found a few issues in Petshop that I didn't encounter with my app, so 
I still have a few tweaks to make to the templates.  I'll post the whole thing 
once I think its working.

Original comment by RoyMunso...@gmail.com on 30 Jul 2010 at 2:49

GoogleCodeExporter commented 9 years ago
Ok, I have attached 2 patches.  One is for the templates themselves, they 
should include the AsyncChildLoader.  The other is an updated version of the 
Petshop app.  I have made a parent/child screen using Profile as the parents 
and Accounts as the list of children.  You should see the lazy loading 
successfully occuring using the AsyncChildLoader.

Original comment by RoyMunso...@gmail.com on 30 Jul 2010 at 10:43

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 2 Aug 2010 at 9:12

GoogleCodeExporter commented 9 years ago
Ok, here is another patch with some fixes.  I found an issue where the child is 
an EditableRootList.  Also, the MarkBusy() and MarkIdle() doesn't work as 
implemented in Rocky's blog (If there are multiple children being lazy loaded 
anyways).  I have made small modifications to fix that, but those lines are 
currently commented out.  Uncommenting them should work fine.

Now that I wrote this, I see that I have exceeded the "Issue attachment 
storage".  How can I send you this patch?

Original comment by RoyMunso...@gmail.com on 5 Aug 2010 at 11:17

GoogleCodeExporter commented 9 years ago
Hello,

Can you please attach the updated patch. I'll be applying this patch sometime 
soon :-).

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 17 Aug 2010 at 10:33

GoogleCodeExporter commented 9 years ago
Hello,

Can you please attach the updated patch. I'll be applying this patch sometime 
soon :-).

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 24 Aug 2010 at 6:52

GoogleCodeExporter commented 9 years ago
Ok, here is the patch.  Please note the above outstanding issues.  Also note 
that the "Exists" issue is still outstanding as well.

Original comment by RoyMunso...@gmail.com on 24 Aug 2010 at 7:20

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 30 Aug 2010 at 1:30

GoogleCodeExporter commented 9 years ago
I'm working on this patch right now...

"Ok, here is another patch with some fixes.  I found an issue where the child 
is an EditableRootList.  Also, the MarkBusy() and MarkIdle() doesn't work as 
implemented in Rocky's blog (If there are multiple children being lazy loaded 
anyways).  I have made small modifications to fix that, but those lines are 
currently commented out.  Uncommenting them should work fine.

Now that I wrote this, I see that I have exceeded the "Issue attachment 
storage".  How can I send you this patch?"

Is this logged someplace / additional patch?

Original comment by bniemyjski on 31 Aug 2010 at 6:49

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 31 Aug 2010 at 6:49

GoogleCodeExporter commented 9 years ago
Hello,

I noticed that only one of the properties had this: 

this.LoadProperty(<%= association.PrivateMemberVariableName %>Property, 
e.Object<% if(IsChildBusinessObject(association)) { %>.Child<% } %>);

Is there a reason one of them should have it and not the others?

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 31 Aug 2010 at 7:28

GoogleCodeExporter commented 9 years ago
Hmmmm...that was a while ago.  I think originally I had a problem where 
e.Object.Child would get called when it wasn't a child object.  That led me to 
only put it in the places that I needed (like OneToMany).  I believe that I 
figured out how to use IsChildBusinessObject after that, so it may in fact work 
in those other spots as well.  

Original comment by RoyMunso...@gmail.com on 31 Aug 2010 at 10:26

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r1926.

Fixed Issue 470: CSLA - Implement a ChildLoader to facilitate Silverlight lazy 
loading

Original comment by bniemyjski on 31 Aug 2010 at 11:06

GoogleCodeExporter commented 9 years ago
Hello,

I have committed the changes for this. If you could please do some additional 
testing and get back to this issue ASAP that would be very nice as I'd like to 
push this release tonight / tomorrow morning.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 31 Aug 2010 at 11:12

GoogleCodeExporter commented 9 years ago
I found a few issues which I can post as a patch.  However we still have the 
Exists issue.  We need to figure out how to get that working asynchronously.

Original comment by RoyMunso...@gmail.com on 1 Sep 2010 at 9:27

GoogleCodeExporter commented 9 years ago
Hello,

Why doesn't the Async Exists work? It uses a a wait handle so it works 
correctly in Silverlight. Could you please post an patch or explain the issues 
:). I'd like to get this out the door today.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 2 Sep 2010 at 11:10

GoogleCodeExporter commented 9 years ago
Check out my comments from this issue:

http://code.google.com/p/codesmith/issues/detail?id=458

You can't use a ManualResetEvent in Silverlight.  It blocks the UI thread 
completely, and the callback never completes.  Give it a try, you'll see it 
lock right up. 

Original comment by RoyMunso...@gmail.com on 2 Sep 2010 at 4:12