有一个内置的方式做一个插入 - 或更新,在城堡的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);