插入或更新在城堡的ActiveRecord城堡、ActiveRecord

2023-09-07 00:28:51 作者:清裳

有一个内置的方式做一个插入 - 或更新,在城堡的ActiveRecord?

线沿线的东西:

 尝试
{
  ActiveRecordMediator< TEntity> .Create(E);
}
赶上(例外)
{
  ActiveRecordMediator< TEntity> .Update(E);
}
 

解决方案

  ActiveRecordMediator<富> .Save(富);
 

英国学校信息更新 布里斯托大学 伦敦大学皇家霍洛威学院 约克大学

Is there a built-in way to do an "insert-or-update" in Castle ActiveRecord?

Something along the lines of:

try
{
  ActiveRecordMediator<TEntity>.Create(e);
}
catch (Exception)
{
  ActiveRecordMediator<TEntity>.Update(e);
}

解决方案

ActiveRecordMediator<Foo>.Save(foo);

 
精彩推荐