Hello,
We're using CSLA .NET 3.5.2, and we have the following code that produces a Csla.Core.UndoException as noted below in the code comment. The exception message is, "Edit level mismatch in CopyState". I'm pretty sure that we're simply misusing the framework in this case; my question is, would the exception be expected behavior? Note that if we flip the order of the two BeginEdit() calls, the crash doesn't occur. Any thoughts? Thanks in advance!
- Whitney
using System;
using Csla;
namespace CslaTest
{
[Serializable]
class A : BusinessBase<A>
{
public readonly BCollection Coll = new BCollection();
}
[Serializable]
class B : BusinessBase<B>
{
[NotUndoable]
public readonly A TheParent = new A();
public B()
{
TheParent.Coll.Add(this);
}
}
class BCollection : BusinessListBase<BCollection, B>
{
}
class Program
{
static void Main(string[] args)
{
B b = new B();
b.BeginEdit();
b.TheParent.BeginEdit(); // causes UndoException
}
}
}
Copyright (c) Marimer LLC