This project is read-only.

Error - EnsureParentRowsExist

Jan 17, 2012 at 5:15 PM


	    Notes newNote;
            foreach (Notes n in from.NotesList)
                newNote = to.ParentCollection.SubDomain.GetCollection<NotesCollection>().NewItem();
This code is located in a self-created deep-copy function and now crashes on the add line for the second item in the list.  It seems to be attempting to ensure that the parent object "to" exists before adding the note to it's list.  For some reason it is failing.  It goes to the database, looks for the "to" object (hasn't been persisted yet) and seems to keep attempting.
This action results in an what seems to be an infinite loop.  I am at a loss, as this code was tested as working a few versions of nhydrate ago.


Jan 21, 2012 at 1:15 AM

The self-reference issue is resolved and will be in the next version

Jan 23, 2012 at 3:51 PM


The tables in this scenario are not self referential.  I am not sure why this occurs other.  I will look closer at this scenario when I get through the rest of my bug list and try out the next version!

In the meantime, if you have any idea why this might be occurring please let me know.


Jan 25, 2012 at 5:11 PM


In the same function I have a foreach loop;

foreach(SubObject o in from.SubObjectList()){...}

A subobject has a nullable fk to primaryobject, and in this case there are none with that fk.  The code attempts to create the list, gets to the following code and enters into space.

internal virtual DataRelation PrimaryObjectsSubObjectRelation
				if (!this.SubObjectsFilled)
					var retrieveRule = new SubObjectsSelectByPrimaryObjectsPks();
				return this.SubDomain.Relations["PrimaryObjectsSubObjectsRelation"];
Specifically, the execution goes into space when it attempts to "RunSelectCommands".  I have confirmed the desired stored procedure exists on the database server.  Beyond that, I am at a loss.

Jan 25, 2012 at 5:54 PM


I finally found the issue.  I attempted to deep copy BEFORE I had added the new PrimaryObject to the subdomain.  Making sure I do the initial AddItem first cleared up all Issues in this thread.

Sorry if you spent anytime on this.