CSLA remove child object -


i new csla , still trying head round it. need know how delete child object through parent ? e.g if have project class (parent) has projectresources (child) , need delete project. how do through csla ? e.g

                project myproject = project.getbyprojectid(projectid);                 projectresourcelist resources = myproject.projectresources;                 myproject.delete();                 if (myproject.isdeleted)                 {                     while (resources.any())                     {                         myproject.projectresources.remove(resources[0].projectresourceid);                      }                 }                 myproject.save(); 

remove() doesnt remove them database. cant delete parent object because sql server complaint referential integrity. don't want stored proc handle cascade delete. suggestions highly appreciated.

thanks.

the csla collection in-memory domain object. when remove item collection item removed active collection , added deletedlist (protected inside collection).

when ask data portal update object graph data access code needs remove items in deletedlist , insert/update items in active collection.

versions of csla since around 2007 automatically invoking appropriate child_insert, child_update, , child_delete methods in child objects contained collection.

in case, can find detailed information data portal operations in 'using csla 4' book.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -