Property change enhancement very minor

Property change enhancement very minor

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


simon_may posted on Friday, February 01, 2008

Hi

I am still very much a Csla 2 user so if this has been done in 3.0 or 3.5 then ignore (tho a quick note on here to say so would be appreciated)

I am heavily dependant on code generation. I some times need to know if a property has been changed. At the moment I hook the PropertyChanged event in my handcrafted partial class, which sems to me to be more expensive than it needs to be. I am on .Net 2.0 at the moment so generating a notification method call in the property set code means that the handrafted partial needs jhas to have handling code in it. Of course when I get up to 3.5 i can use partial methods, better. However then i will be moving to CSLA 3.5 where, from what I understand. property changed stuff gets buried in the framework. Perhaps the property change stuff could call a virtual method, say OnPropertyHasChanged(PropertyInfo info).

As I said, not a life and death issue, more about keeping things tidy.

Simon

Ps: And yes I could go and read all the later docs - this is just a passing thought

amselem replied on Friday, February 01, 2008

Just a quick comment, I think that you can use partial methods with .net runtime 2.0 without problems because is a compiler feature not a language one. So you can build it with the 3.5 compiler but target the .net 2.0 platform and get this feature (and others too, like type inference).
HTH

simon_may replied on Friday, February 01, 2008

Thanks for the tip. I'll try it when I upgrade to VS2008

RockfordLhotka replied on Friday, February 01, 2008

PropertyHasChanged() is virtual, so you can override that method to find out when a property has been changed.

Just make sure to call the base implementation first, so the normal processing occurs before you try to respond!!

simon_may replied on Friday, February 01, 2008

Not surprised, you are that sort of fellow. Teach me not to investigate further. Thanks

Simon

Copyright (c) Marimer LLC