saving collections in an entity

Posts   
 
    
carlor
User
Posts: 34
Joined: 12-Jan-2005
# Posted on: 21-Jan-2005 16:32:13   

Hi there,

I have an entity that contains a few sub-collections. I am trying to add a new entity to a sub-collection and modify some fields in the main entity. I then want to save everything at once. I have tried using the entity's Save method but it doesn't seem to filter down to the sub-collections. Is this not the way it's supposed to work?

What I find I have to do is: - get the collection from the main entity - create a new entity for that collection and fill it - save the collection using SaveMulti - save the main entity - refetch the entity - re-bind the collection to the datagrid which picks up the new collection's entity but not the new entityId for it.

Am I doing something wrong? Why doesn't the entity's Save method filter down through the collections?


        mClaim = New PANEL_MEMBER_CLAIMEntity(mClaimId)
        mClaim.PM_PER_DIEM_HEARING(0).START_TIME_DELIBERATION = "12:00"
        mClaim.PM_PER_DIEM_HEARING(0).END_TIME_DELIBERATION = "12:30"

        Dim hearing As New PM_PER_DIEM_HEARINGEntity
        hearing.START_TIME_DELIBERATION = "2358"
        hearing.END_TIME_DELIBERATION = "2358"

        mClaim.PM_PER_DIEM_HEARING.Add(hearing)
        Dim count As Integer = mClaim.PM_PER_DIEM_HEARING.SaveMulti()

        Dim bRc As Boolean = mClaim.Save()

        mClaim.Refetch()

        DataGrid1.DataBind()

Thanks,

Carlo.

carlor
User
Posts: 34
Joined: 12-Jan-2005
# Posted on: 21-Jan-2005 16:50:27   

Ok. I think I just found the answer to my own question. I wasn't calling Save(True) so it wasn't saving recursively. I just tried it and it worked.

Carlo.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 21-Jan-2005 17:34:41   

Selfservicing's Save() is indeed not recursive by default, as that was the original implementation and for backwards compatibility it's kept that way. simple_smile

Frans Bouma | Lead developer LLBLGen Pro