HighTechTalks DotNet Forums  

Re: Input needed, using lazy load with business entities

Dotnet Distributed Applications microsoft.public.dotnet.distributed_apps


Discuss Re: Input needed, using lazy load with business entities in the Dotnet Distributed Applications forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Fabrizio Camussa
 
Posts: n/a

Default Re: Input needed, using lazy load with business entities - 06-25-2003 , 06:52 AM






Dear All,
to solve this problem let the business entities to communicate with the
Business Logic through an interface defined in the Business Entity package,
but implemented in the Business Logic Data. Each BL class have to implement
this interface. Such a kind of interface can be set by the BL at BE creation
time

Hope it helps,
Fabrizio.

Remember that lazy load is not the best way to go on in case your
application is distributed. If infact the BLs are remote components the best
way is to go to the opposite solution, (load as much as possible on each
remote rountrip)






"Jimmy Nilsson" <Jimmy.Nilsson (AT) nospam_jnsk (DOT) se> wrote

Quote:
Hi TEK,

I'm having the same problem and the solution I'm thinking about to use is
to
hand the entity a logic instance (with your words). So the entity will
call
the logic component instance (via an interface) when it needs data to be
lazy loaded.

When strictly using Service Layer pattern [Fowler PoEAA], it seems to me
that it creates this lazy load-problem... The solution I mention above
doesn't feel that very good. I will carefully follow this thread to see if
there will come up better proposals.

Best Regards,
Jimmy
www.jnsk.se/weblog/
###

"TEK" <trondeirikkolloen (AT) hotmail (DOT) com> wrote in message
news:eU7Qs9uODHA.1072 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Hello

I could need some input on this issue.
All ideas would us received with thanks...

Application structure:
- Thin client (currently an windows app)
- Business layer
Business Entity components
Business logic components
- Data layer

The Business Entity components is created by the Business logic
components.
typically usage:
User user = new User();
UserInfo myself = user.GetUserByName("tek");
// do stuff with myself ;-)
user.SaveUser(myself);

The Business Entities may also contain other business entities, UserInfo
may
for example hold an collection of GroupInfo objects. (the groups a user
is
member of).

So to the issue, with large listings (for example when calling
user.GetAllUsers()), you may only need/want the basic information, not
the
connected info objects.
Normally, a logical way to solve this would be to implement layze
loading,
meaning that the users Group would not be filled until the calling
method
actually called:
GroupInfoCollection groups = myself.Groups();

But to do that, the entity layer would have to have a reference to the
Business logic components, and wholia, a sircular reference.
At the same time that would lead to put business logic into the info
objects, which I'm not to keen on.

Any good ideas out there?

Best reagards, TEK







Reply With Quote
  #2  
Old   
Ice
 
Posts: n/a

Default Re: Input needed, using lazy load with business entities - 06-25-2003 , 09:01 AM






Got any code samples?

ice
"Fabrizio Camussa" <fabrizio.camussa (AT) datamat (DOT) it> wrote

Quote:
Dear All,
to solve this problem let the business entities to communicate with the
Business Logic through an interface defined in the Business Entity
package,
but implemented in the Business Logic Data. Each BL class have to
implement
this interface. Such a kind of interface can be set by the BL at BE
creation
time

Hope it helps,
Fabrizio.

Remember that lazy load is not the best way to go on in case your
application is distributed. If infact the BLs are remote components the
best
way is to go to the opposite solution, (load as much as possible on each
remote rountrip)






"Jimmy Nilsson" <Jimmy.Nilsson (AT) nospam_jnsk (DOT) se> wrote in message
news:eE5TNRvODHA.2316 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Hi TEK,

I'm having the same problem and the solution I'm thinking about to use
is
to
hand the entity a logic instance (with your words). So the entity will
call
the logic component instance (via an interface) when it needs data to be
lazy loaded.

When strictly using Service Layer pattern [Fowler PoEAA], it seems to me
that it creates this lazy load-problem... The solution I mention above
doesn't feel that very good. I will carefully follow this thread to see
if
there will come up better proposals.

Best Regards,
Jimmy
www.jnsk.se/weblog/
###

"TEK" <trondeirikkolloen (AT) hotmail (DOT) com> wrote in message
news:eU7Qs9uODHA.1072 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Hello

I could need some input on this issue.
All ideas would us received with thanks...

Application structure:
- Thin client (currently an windows app)
- Business layer
Business Entity components
Business logic components
- Data layer

The Business Entity components is created by the Business logic
components.
typically usage:
User user = new User();
UserInfo myself = user.GetUserByName("tek");
// do stuff with myself ;-)
user.SaveUser(myself);

The Business Entities may also contain other business entities,
UserInfo
may
for example hold an collection of GroupInfo objects. (the groups a
user
is
member of).

So to the issue, with large listings (for example when calling
user.GetAllUsers()), you may only need/want the basic information, not
the
connected info objects.
Normally, a logical way to solve this would be to implement layze
loading,
meaning that the users Group would not be filled until the calling
method
actually called:
GroupInfoCollection groups = myself.Groups();

But to do that, the entity layer would have to have a reference to the
Business logic components, and wholia, a sircular reference.
At the same time that would lead to put business logic into the info
objects, which I'm not to keen on.

Any good ideas out there?

Best reagards, TEK









Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.