IsDirty not changing after edit.

IsDirty not changing after edit.

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


hanspret posted on Monday, September 20, 2010

Hi 

I have bought and read the "Expert C# 2008 Business Objects" book and changed my Business Layer code accordingly. My properties Now look like this for example:

 

"public static PropertyInfo<string> MineNameProperty = RegisterProperty<string>(c => c.MineName);

public string MineName

{

get { return GetProperty(MineNameProperty); }

set { LoadProperty(MineNameProperty, value); }

}"

My problem is that my object's IsDirty property doesn't change to true if I edit the object like this:

MineName = "MyName";

 

It always stay false. Can anybody point me to what I am missing?

 

hanspret replied on Monday, September 20, 2010

As I post the question I read through my writing and saw that I use LoadProperty instead of SetProperty. I have changed this and now it is working.

I assume LoadProperty is for a ReadOnly object and SetProperty is for an Editable object.

Marjon1 replied on Monday, September 20, 2010

LoadProperty is useful when fetching data as well, therefore not marking your object as dirty or running validation rules.

Copyright (c) Marimer LLC