DataPortal.ChildCreate & access from database?

DataPortal.ChildCreate & access from database?

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


ajj3085 posted on Monday, November 24, 2008

Hi,

I currently have a child object, and the New factory method uses DataPortal.ChildCreate to create the child.  I need to hit the database for some defaults.. but it doesn't look like the child DP will use remoting... or am I reading the code wrong?  Should I use the normal Create and call MarkAsChild?

sergeyb replied on Monday, November 24, 2008

No, you are correct, child portal is not going to the server.   So you  have to options:

1.                   Allow the root’s Create to fire remotely and populate children once you inside the DataPortal_Create

2.                   Instead of create child call MyChild.GetDefault that will call the DataPortal.Fetch or fire a command object.

 

In either case you have to manually call MarkAsChild()

 

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: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Monday, November 24, 2008 11:42 AM
To: Sergey Barskiy
Subject: [CSLA .NET] DataPortal.ChildCreate & access from database?

 

Hi,

I currently have a child object, and the New factory method uses DataPortal.ChildCreate to create the child.  I need to hit the database for some defaults.. but it doesn't look like the child DP will use remoting... or am I reading the code wrong?  Should I use the normal Create and call MarkAsChild?


ajj3085 replied on Monday, November 24, 2008

Thanks Sergey, just wanted to make sure I didn't miss something.

Copyright (c) Marimer LLC