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();
                n.FillObject(newNote);
                to.NotesList.Add(newNote);
            }
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.
Suggestions?

Steve

Jan 21, 2012 at 1:15 AM

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

Jan 23, 2012 at 3:51 PM

Codetools,

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.

Steve

Jan 25, 2012 at 5:11 PM

Chris,

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
		{
			get
			{
				if (!this.SubObjectsFilled)
				{
					var retrieveRule = new SubObjectsSelectByPrimaryObjectsPks();
					this.SubDomain.AddSelectCommand(retrieveRule);
					this.SubDomain.RunSelectCommands();
				}
				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

Nevermind,

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.

Steve