Save child object using Mybase.Save

Save child object using Mybase.Save

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


haripriya_kumar posted on Friday, January 11, 2008

Hi,

I have created an EditableRootListBase collection (C) which holds BusinessBase object (B), through the collection I can add/get/delete/edit any BusinessBase object(B) in it. I want to be able to make the BusinessBase object (B) exists by itself, currently I can instantiate just the BusinessBase object (B) but I can’t save it.  I have used

Public Overrides Function Save() As B

           Return MyBase.Save()

 End Function

to save the object by itself, I get an error “ Object is not valid and can not be saved”

ajj3085 replied on Friday, January 11, 2008

Nothing's wrong with your code; the object simply has IsValid returning false.  So use a breakpoint on your method and check the BrokenRulesCollection.

haripriya_kumar replied on Friday, January 11, 2008

Yes, thats right, one of the validation rule was broken.

Thanks.

Copyright (c) Marimer LLC