CSLA 3.0.4.0: EditLevel

CSLA 3.0.4.0: EditLevel

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


cjherasmus posted on Tuesday, July 15, 2008

Using:

VS 2005 C#, CSLA 3.0.4, Remoting, SQL 2005, Infragistics UltraGrid

I have a solution much like the PT project. I have Person, Contract, PersonContract, PersonContracts and Assignment. A Contract is assigned to a Person. A Person have many assigned contracts.

I have a single form with Person attributes and Contracts grid. Assigning and removing to the grid works great but the Contracts does not get saved to the DB when editing a Person. Funny thing is: when a new person object is created and contracts assigned, everything gets saved to DB. If the object is opened for editing, the contracts gets assigned but not saved to DB. The only way to solve is to make a change on a person attribute, then the contracts get saved.

I get the idea that it's something to do with the editlevel of the person object. In my case I have to get the edit level of person to 1 before I can save contracts. Isn't this wrong ?

Explanation would be appreciated.

Regards, Thanks

Dawn replied on Tuesday, July 15, 2008

It look like  you don't override IsDirty, a new Person is always dirty, so it save child collection to DB,  old Person dones't save to DB util it's get dirty.

cjherasmus replied on Tuesday, July 15, 2008

Dawn,

do you mean this, which is in my Person BO

public override bool IsDirty

{

      get { return base.IsDirty || _contracts.IsDirty; }

}

Dawn replied on Wednesday, July 16, 2008

The IsDirty is correct. I have no idea, sorry.

Copyright (c) Marimer LLC