Hi.
I think you should control this in your mapping classes, using a property called, for example, "IsDeleted".
When you have a list of objects and delete some of them, call obj.MarkAsDeleted(), for example.
I've got this using the MyGeneration. When you generate your mapping classes/xmls, the MyGeneration Software adds two properties to control if the object is changed or deleted.
Looks like this:
Code:
// ...
private bool _isChanged;
private bool _isDeleted;
// ...
/// <summary>
/// Returns whether or not the object has changed it's values.
/// </summary>
public bool IsChanged
{
get { return _isChanged; }
}
/// <summary>
/// Returns whether or not the object has changed it's values.
/// </summary>
public bool IsDeleted
{
get { return _isDeleted; }
}
// ...
/// <summary>
/// mark the item as deleted
/// </summary>
public void MarkAsDeleted()
{
_isDeleted = true;
_isChanged = true;
}
The "IsChanged" property changes its values when you call the method Set from any property from your object.
Take a look at the definition of a property:
Code:
public int? Sexintervalo
{
get { return _sexintervalo; }
set { _isChanged |= (_sexintervalo != value); _sexintervalo = value; }
}
As you can see, it's easy to get the state of an object.
I've never used this approach ... but I think this will help me when I start to use colletions (master detail, for example).
Bye!