private static void InternalUpdate(object instance, bool flush)
{
if (instance == null) throw new ArgumentNullException("instance");
EnsureInitialized(instance.GetType());
ISession session = holder.CreateSession(instance.GetType());
try
{
session.Update(instance);
if (flush)
{
session.Flush();
}
}
catch (ValidationException)
{
holder.FailSession(session);
throw;
}
catch (Exception ex)
{
holder.FailSession(session);
throw new ActiveRecordException("Could not perform Update for " + instance.GetType().Name, ex);
}
finally
{
holder.ReleaseSession(session);
}
}