If I recall correctly, it was there to deal with SL data grid
bug, that I think was fixed in December drop.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Jack
[mailto:cslanet@lhotka.net]
Sent: Thursday, January 29, 2009 1:32 AM
To: Sergey Barskiy
Subject: [CSLA .NET] DisableIEditableObject in Rolodex Example
Is there a reason this is set to true? The 2008 book
recommends not setting it - is this a silverlight thing? If so, why is it
also in the private constructor?
If my plan was to have a Silverlight version and one or more non-Silverlight
version is this something I should not be turning off?
I'm asking as I currently have my constuctors defined in my codeGen templates
so it will come out in all classes.
Thanks
jack
Thanks – I’m ignoring it then.
jack
From: Sergey Barskiy
[mailto:cslanet@lhotka.net]
Sent: Thursday, January 29, 2009 6:14 AM
To: jaddington@alexandergracie.com
Subject: RE: [CSLA .NET] DisableIEditableObject in Rolodex Example
If I recall correctly, it was there to deal with SL data grid
bug, that I think was fixed in December drop.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Jack
[mailto:cslanet@lhotka.net]
Sent: Thursday, January 29, 2009 1:32 AM
To: Sergey Barskiy
Subject: [CSLA .NET] DisableIEditableObject in Rolodex Example
Is there a reason this is set
to true? The 2008 book recommends not setting it - is this a silverlight
thing? If so, why is it also in the private constructor?
If my plan was to have a Silverlight version and one or more non-Silverlight
version is this something I should not be turning off?
I'm asking as I currently have my constuctors defined in my codeGen templates
so it will come out in all classes.
Thanks
jack
Just as an aside, I use DisableIEditableObject in my WinForms application, because evidently some elements of the UI design are unusual and are seemingly incompatible with the default binding implementation. (I'd do it differently and be compatible, but I lost that battle).
Anyway, turning IEditableObject off (DisableIEditableObject=true) means your objects will ignore all calls made via the IEditableObject interface, making you completely responsible for doing BeginEdit()/ApplyEdit()/CancelEdit() yourself. You still have N-level undo capability, provided you implement it yourself by making these calls at the correct point in time.
My understanding from the forum here is that WPF and Silverlight are better behaved (more consistent?) in their handling of IEditableObject and that disabling it should rarely be necessary.
I think most EditLevel errors can be avoided by using CSLA managed properties in 3.5 for child lists and BO's (the managed property infrastructure will set the edit level properly when a child BO is born while editing) and by properly unbinding the object, saving it, and rebinding the returned reference (search for RebindUI for examples).
The show stopper for me was that we have a ERLB side by side with a property sheet for the current object in the list. Once IEditableObject.BeginEdit() has been called, subsequent CopyState() aren't cascaded through the object graph to the BO descendants anymore, so my undo didn't work. There might be a solution, but I decided to take over the edit management myself and so far it's working OK.
Incidentally, once I disabled IEditableObject and doing my own BeginEdit(), I found all my EditLevel problems where I wasn't syncing up the edit level (this was before managed properties, and one of the main reasons I use them for child objects now).
Luc,
"Basically, I would Clone() the BO before saving, and in case of exception being thrown, I'd rebind the cloned BO"
I hope you are aware that as of 3.5 Rocky clones the BO for you automatically on Save. Unless you configure AutoCloneOnUpdate=False in your config file. The default is now True.
I am not sure if this is part of the reason for your pain or not. I do not do much binding in Winforms. I have a Web app and do most things manually.
Joe
Pages 304-312 of the new book discuss the CslaActionExtender. It is supposed to help simplify the complexity associated with binding.
I won't even *try* to summarize 8 pages of Rocky's book in a thread!
Check it out.
Joe
Copyright (c) Marimer LLC