For simplicity sake I'd say yes, you must register your objects
immediately. The easiest way to do it is of course via
DataContext.createAndRegisterNewObject().
As for the details, in 1.1 registration is required prior to setting
any relationships, but attributes can be initialized on an
unregistered object. 1.2 relaxes this somewhat - it auto-registers an
object behind the scenes when a relationship is established with
another object that is already in the DataContext. So you can
register your initial object and then attach other objects to it,
causing automatic registration (sort of "persistence by reachability").
I personally still prefer "createAndRegisterNewObject" to be used for
all objects for consistency.
Andrus
On Jul 8, 2005, at 10:58 AM, shaun wrote:
> Hi,
>
> Please excuse my ignorance, but are there any problems with creating
> data objects and not registering them with a DataContext
> immediately? I
> was under the impression that one should always register the data
> object
> with a context before using the object.
>
> regards,
> -
> shaun
This archive was generated by hypermail 2.0.0 : Fri Jul 08 2005 - 03:25:43 EDT