c# - I get a "Edit level mismatch in CopyState" error in CSLA depending on where my BeginEdit is executed -


I am currently using CSLA 4.5 and running in a problem where I get an error

copy paste

What's odd is that if I enter execEdit () on a business object in one part of the code I do not have the problem, it does not have the problem, but if I put it in my popup window logic, then it throws an exception, and I Not sure why the main part is strange that it is the same purpose :

MainControl.xaml.cs :

  Public Zero ShowPopup () {// ... var target = ...; //target.BeginEdit (); & Lt; == There is no problem if I get this var window = new popup window {DataContext = new confirmation ViewModel (target), IsApplyCancel = true, boss = this,}; Window.Show (); Public class popup window: Window {Private Static Zero ONSpeople Convert Connection (Object Sender, DependencyPropertyChangedEventArgs Args) {var window = as the sender window; If (window! = Null) {var context = window.CataLaviewModelBase as DataContext; If (context! = Null) {var target = context.Target; Target.BeginEdit (); // exception !!! }}}}  

confirmation ViewModel.cs :

  public class confirmation view Model: CSLAViewModelBase {public confirmation ViewModel (BusinessBase Target): Base (target) {...}}  

Databasing IIS usually You call it automatically when IEditableObject and object form is bound to occur. This interface does not know about N level, however, if CSLA detects many calls for those methods then it throws an exception. You probably do not need BeginEdit in your dialogue and after unbounding the form's object only Cancel or do not have to worry about endaid.

The View Modelbase also does it for you that I believe.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -