Hi
I have (basically) a Master-Detail type windows form, mirroring a 1:n relationship between 2 tables in my DB; Bug and BugDetail. The UI is such that the user can select a Bug record, and then edit both it and related BugDetail records. The whole lot is then saved using a recursive .Save() on the Bug Entity.
I am using databinding so that the edit fields for the detail portion of the UI are bound to BugDetail entity objects. When the user wants to create a new BugDetail row, I must create a new BugDetail entity object in order that I can bind the UI controls to the relevant properties of the entity.
My problem is that in the event the user doesn't actually enter anything for the newly-created BugDetail entity, I dont want to insert it into the DB, as its a blank record.
So, just prior to the
.Save(true);
call on the Bug entity, I am iterating through the BugDetail collection, calling
.Delete()
on anything that is blank. (This also removes any existing records where the user has removed all detail). However, it doesn't seem to work for newly-created entities: the blank BugDetail record gets saved anyway.
I have also tried using
.CancelEdit();
, which is not mentioned in the LLBLGen doco but had a very helpful-sounding Intellisense description! Sadly, that doesn't work either.
So, what am I doing wrong? I am using SelfServicing for .NET 2.0, LLBLGenPro version 2.0.0 DEMO, C#, SQL Server 2000, Windows Forms.
Cheers
Brett