Lazy Loading question

Lazy Loading question

Old forum URL: forums.lhotka.net/forums/t/5837.aspx


Cosmin posted on Thursday, November 20, 2008

Hi,

What happpens if I create a lazy property(ReadOnlyBase) and don't use it on the clientat all but use it on the server on update or insert?

Say we have a Customer object and a PriceList(lazy) associated with it. On the update of the customer I need some data from the PriceList. What happens if I touch the PriceList property on the server side?

I know, the best way to know is to try it but don't have time right now and I also need to know if it is ok or my design is not right.

sergeyb replied on Thursday, November 20, 2008

I am not sure if you even need this property at all then.  You can simply query the DB directly during DataPortal_Update/Insert method.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: Cosmin [mailto:cslanet@lhotka.net]
Sent: Thursday, November 20, 2008 12:02 PM
To: Sergey Barskiy
Subject: [CSLA .NET] Lazy Loading question

 

Hi,

What happpens if I create a lazy property(ReadOnlyBase) and don't use it on the clientat all but use it on the server on update or insert?

Say we have a Customer object and a PriceList(lazy) associated with it. On the update of the customer I need some data from the PriceList. What happens if I touch the PriceList property on the server side?

I know, the best way to know is to try it but don't have time right now and I also need to know if it is ok or my design is not right.



rsbaker0 replied on Thursday, November 20, 2008

I think this works just fine.

In your Customer example,  the object returned from the server after an update/insert will have a populated PriceList that will be returned with the object.

Cosmin replied on Friday, November 21, 2008


What happens if you call DataPortal.Fetch on the server side? Is the DataPortal aware of the context and just execute the fetch directly or it will follow the same execution path as if it ran on the client side(get serverside dataportal call the fetch and pass the object, etc). That would be a problem I feel.

rsbaker0 replied on Friday, November 21, 2008

DataPortal.Fetch on the "server" side would typically use the "local" data portal. You can freely use your CSLA objects on the server, but any fetching/saving occurs on the same machine. CSLA calls on the server works like a single machine deployment with all your execution logic running on the same machine.

That being said, I believe it is possible to chain data portals from one server to another, but that probably isn't typical.

Copyright (c) Marimer LLC