Castle.ActiveRecord.ActiveRecordBase.Refresh C# (CSharp) Method

Refresh() protected static method

Refresh the instance from the database.
protected static Refresh ( object instance ) : void
instance object The ActiveRecord instance to be reloaded
return void
		protected internal static void Refresh(object instance)
		{
			if (instance == null) throw new ArgumentNullException("instance");

			EnsureInitialized(instance.GetType());

			ISession session = holder.CreateSession(instance.GetType());

			try
			{
				session.Refresh(instance);
			}
			catch (Exception ex)
			{
				holder.FailSession(session);

				// NHibernate catches our ValidationException, and as such it is the innerexception here
				if (ex.InnerException is ValidationException)
				{
					throw ex.InnerException;
				}
				else
				{
					throw new ActiveRecordException("Could not perform Refresh for " + instance.GetType().Name, ex);
				}
			}
			finally
			{
				holder.ReleaseSession(session);
			}
		}

Same methods

ActiveRecordBase::Refresh ( ) : void

Usage Example

Ejemplo n.º 1
0
 /// <summary>
 /// Refresh the instance from the database.
 /// </summary>
 /// <param name="instance">The ActiveRecord instance to be reloaded</param>
 public static void Refresh(object instance)
 {
     ActiveRecordBase.Refresh(instance);
 }
All Usage Examples Of Castle.ActiveRecord.ActiveRecordBase::Refresh