I always wonder why csla objects call markdirty in marknew. The problem i have is to create one to one relationship object.
For example, i have customer object and customerAddress object which is one2one. i like to code like:
MyCustomer.id = 1
MyCustomer.Name = "test"
MyCustomer.MyCustomerAddress.Street = "no where"
...
but sometimes i might not like to create MyCustomerAddress when it's not changed and since it's markdirty from beginning , i have no idea it's changed or not.
Also sometimes we have an object is a one2one child of itself, like an employee which has a suppervisor object which is also an employee. Now it's impossible for me to create object like that 'cause it creates infinite loop when saving the object.
I have no idea how your guys handle these scenarios, please enlighten me!!! thank in advance.
thx a lot. Yes that makes some sense but how do you solve this one 2 one relationship?
public class employee
public property employeeid as integer
public suppervisor as employee
end class
in my client code, if i do:
objEmployee.id = 1
objEmployee.Save()
that would enter into an infinite loop(--->objEmployee.supervisor.save--->objEmployee.supervisor.supervisor.save...)
so i have to code like:
dim obj as employee = employee.newemployee()
obj.supervisor.delete()
obj.id= 1
obj.save
That's really weird, and i have no idea when i should call "obj.supervisor.delete()" and when i should not.
Also I am not really convinced by this dirty definition for a number of reasons:
1) why give object user something which is only vaguely correct? i think you can only say "dirty = false" mean the object probably matches the database. As an object user, how does that help me?
2) business objects are created for their users. As an object user, i need a way of knowing whether my cleint app made any change to the object or not? That sounds like a very important feature to me.
3) how do you explain "deleted object"? yes they are marked as deleted but they are still matched to the database, so why are they "dirty"?
Copyright (c) Marimer LLC