a different object with the same identifier value was already associated with the session (MonoRail + ActiveRecord)

遇到这个问题的代码很可能像这样:


[Layout("default")]
public void Save([ARDataBind("item")]Item item)
{
        item.Save();
}

解决它的办法也很简单,改成下面这样就可以了:

[Layout("default")]
public void Save([ARDataBind("item", AutoLoadBehavior.NewInstanceIfInvalidKey)]Item item)
{
        item.Save();
}

posted on 2007-09-18 12:18  deerchao  阅读(1259)  评论(1编辑  收藏  举报