CSLA中修改数据的问题 [英] the problem of modify data in CSLA

查看:82
本文介绍了CSLA中修改数据的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我调用Save()方法引发异常"Can not directly save a child object"时,如何保存子对象?

When I call the Save() method throw exception "Can not directly save a child object", how to save a child object?

推荐答案

我之所以回答,是因为我很好奇CSLA是什么.在16.3秒内,我学会了:

I''m answering this because I was curious what CSLA was. In 16.3 seconds I learned:

子对象的确切定义是将其作为其父对象的一部分持久保存.那是您不能保存子对象的一种奇特的说法,因为这是CSLA的设计方式.

即使您(并且可以)取消围绕保存子对象的常规保护措施,也可能会使父对象感到困惑,这会导致其他问题.

如果您需要直接保存此对象,则它是根对象,而不是子对象.如果是这种情况,则该对象不能包含在另一个对象中,它必须是独立的.
-CSLA的创建者Rockford Lhotka
The very definition of a child object is that it is persisted as part of its parent. That''s a fancy way of saying that you can''t save a child object, because that''s how CSLA is designed.

Even if you defeat the normal protections around saving a child object (and you can), you''d confuse the parent object and that would cause other problems.

If you need to save this object directly, then it is a root object, not a child object. And if that''s the case, then the object can''t be contained by another object, it must stand alone.
-- Rockford Lhotka, creator of CSLA

http://forums.lhotka.net/forums/t/7201.aspx [ http://forums.lhotka.net/forums/p/5361/26017.aspx [ ^ ]

http://forums.lhotka.net/forums/t/7201.aspx[^]
http://forums.lhotka.net/forums/p/5361/26017.aspx[^]


这篇关于CSLA中修改数据的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆