Subsonic 3 Save() then Update()?

前端 未结 1 1398
逝去的感伤
逝去的感伤 2021-01-07 15:23

I need to get the primary key for a row and then insert it into one of the other columns in a string.

So I\'ve tried to do it something like this:

ne         


        
1条回答
  •  醉酒成梦
    2021-01-07 15:49

    I faced the same problem with that :

    po oPo = new po();

    oPo.name ="test";

    oPo.save(); //till now it works.

    oPo.name = "test2";

    oPo.save(); //not really working, it's not saving the data since isLoaded is set to false and the columns are not considered dirty.

    it's a bug in the ActiveRecord.tt for version 3.0.0.3.

    In the method public void Add(IDataProvider provider) immediately after SetIsNew(false); there should be : SetIsLoaded(true);

    the reason why the save is not working the second time is because the object can't get dirty if it is not loaded. By adding the SetIsLoaded(true) in the ActiveRecord.tt, when you are going to do run custom tool, it's gonna regenerate the .cs perfectly.

    0 讨论(0)
提交回复
热议问题