![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
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 |
#2
| |||
| |||
|
|
I think a key post mentioned here is analyzing the use case and returning a subset of the object graph. Hopefully this can be narrow down to a few (maybe 2 or 3) load varieties and avoid lazy load altogether because its a pain. |
|
Fabrizio's method of solving this problem seems to be the cleanest. |
|
All - I'm not sure if the service layer enforces this at all. I'm sure you could have your domain model directly call the mappers, but that would nullify the whole reason why the mappers exist. I think a service layer and data transfer object are essential because you don't want the client to be dependent on the domain model (but this is probably opening up another can of worms). I think a key post mentioned here is analyzing the use case and returning a subset of the object graph. Hopefully this can be narrow down to a few (maybe 2 or 3) load varieties and avoid lazy load altogether because its a pain. Fabrizio's method of solving this problem seems to be the cleanest. ice "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 |
#3
| |||
| |||
|
|
All - I'm not sure if the service layer enforces this at all. I'm sure you could have your domain model directly call the mappers, but that would nullify the whole reason why the mappers exist. I think a service layer and data transfer object are essential because you don't want the client to be dependent on the domain model (but this is probably opening up another can of worms). I think a key post mentioned here is analyzing the use case and returning a subset of the object graph. Hopefully this can be narrow down to a few (maybe 2 or 3) load varieties and avoid lazy load altogether because its a pain. |
|
Fabrizio's method of solving this problem seems to be the cleanest. ice "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 |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |