Search code examples
.netcastle-activerecord

Insert or Update in Castle ActiveRecord


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);
}

Solution

  • ActiveRecordMediator<Foo>.Save(foo);