解决 DevExpress.Xpo.Exceptions.SessionMishingException
我将一个对象添加到另一个对象,如下所示:
Foo foo = new Foo();
AnotherClass.bar.add(foo); // bar is getting assigned with dependency injection in AnotherClass
这会导致 DevExpress.Xpo.Exceptions.SessionMishingException ,如下所示:
初始化方法 Test.SetUp 抛出 例外。 DevExpress.Xpo.Exceptions.SessionMishingException: DevExpress.Xpo.Exceptions.SessionMishingException: “Foo”对象属于不同的会话。
如何从 AnotherClass 获取会话以避免此错误?
I'm adding an object to another object like so:
Foo foo = new Foo();
AnotherClass.bar.add(foo); // bar is getting assigned with dependency injection in AnotherClass
This causes a DevExpress.Xpo.Exceptions.SessionMixingException as follows:
Initialization method
Test.SetUp threw
exception. DevExpress.Xpo.Exceptions.SessionMixingException:
DevExpress.Xpo.Exceptions.SessionMixingException: The
'Foo' object belongs to a different session.
How does one grab get a hold of the session from AnotherClass to avoid this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以简单地在 AnotherClass 的会话中加载 foo 对象,
您可以在 http://www.devexpress.com/Products/NET/ORM/articles/SessionManagementCaching.xml
You can simply load the foo object within AnotherClass' Session with,
You can read more how the session works at http://www.devexpress.com/Products/NET/ORM/articles/SessionManagementCaching.xml