Skip to content
Discussion options

You must be logged in to vote

When lazy loading a child object, you should use a command pattern to invoke the data portal on a root object (the command).

The child data portal does NOT move the call from client to the logical server, so you should NOT be calling the child data portal directly. That causes the problems you describe, plus it will fail if you ever switch to an n-tier deployment.

The command class can look something like this:

[Serializable]
public class ChildGetter : ReadOnlyBase<ChildGetter>
{
  // declare standard CSLA property for Child - pseudo-code here:
  cslaprop ChildType Child { get; set; }

  [Create]
  private void Create([Inject] IChildDataPortal<Child> dp)
  {
    Child = dp.CreateChild();
  }

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TanguyIngels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants