/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="targetType">The target ActiveRecordType</param> /// <param name="call">The delegate instance</param> /// <param name="instance">The ActiveRecord instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> protected internal static object Execute(Type targetType, NHibernateDelegate call, object instance) { if (targetType == null) { throw new ArgumentNullException("targetType", "Target type must be informed"); } if (call == null) { throw new ArgumentNullException("call", "Delegate must be passed"); } EnsureInitialized(targetType); ISession session = _holder.CreateSession(targetType); try { return(call(session, instance)); } catch (Exception ex) { throw new ActiveRecordException("Error performing Execute for " + targetType.Name, ex); } finally { _holder.ReleaseSession(session); } }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="call">The delegate instance</param> /// <param name="instance">The ActiveRecord instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> public object Execute(NHibernateDelegate call, T instance) { var dados = DetachedCriteria.For <ClasseModelo>(); var targetType = instance.GetType(); if (targetType == null) { throw new ArgumentNullException("targetType", "Target type must be informed"); } if (call == null) { throw new ArgumentNullException("call", "Delegate must be passed"); } EnsureInitialized(targetType); var holder = ActiveRecordMediator.GetSessionFactoryHolder(); ISession session = holder.CreateSession(targetType); try { return(call(session, instance)); } catch (ValidationException) { holder.FailSession(session); throw; } catch (Exception ex) { holder.FailSession(session); throw new ActiveRecordException("Error performing Execute for " + targetType.Name, ex); } finally { holder.ReleaseSession(session); } }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="targetType">The target ActiveRecordType</param> /// <param name="call">The delegate instance</param> /// <param name="instance">The ActiveRecord instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> public static object Execute(Type targetType, NHibernateDelegate call, object instance) { return ActiveRecordBase.Execute(targetType, call, instance); }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="targetType">The target ActiveRecordType</param> /// <param name="call">The delegate instance</param> /// <param name="instance">The ActiveRecord instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> protected internal static object Execute(Type targetType, NHibernateDelegate call, object instance) { if (targetType == null) throw new ArgumentNullException("targetType", "Target type must be informed"); if (call == null) throw new ArgumentNullException("call", "Delegate must be passed"); EnsureInitialized(targetType); ISession session = holder.CreateSession(targetType); try { return call(session, instance); } catch (ValidationException) { holder.FailSession(session); throw; } catch (Exception ex) { holder.FailSession(session); throw new ActiveRecordException("Error performing Execute for " + targetType.Name, ex); } finally { holder.ReleaseSession(session); } }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="call">The delegate instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> protected internal virtual object Execute(NHibernateDelegate call) { return Execute(GetType(), call, this); }
public IEnumerable Filter(object collection, string filterString) { NHibernateDelegate call = (session, obj) => session.CreateFilter(collection, filterString).List(); return((IEnumerable)ActiveRecordMediator.Execute(typeof(ActiveRecordBase), call, null)); }
public virtual object Execute(NHibernateDelegate call) { return(ActiveRecordBase.Execute(typeof(T), call, this)); }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="targetType">The target ActiveRecordType</param> /// <param name="call">The delegate instance</param> /// <param name="instance">The ActiveRecord instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> public static object Execute(Type targetType, NHibernateDelegate call, object instance) { return(ActiveRecordBase.Execute(targetType, call, instance)); }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="call">The delegate instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> protected internal object Execute(NHibernateDelegate call) { return(Execute(this.GetType(), call, this)); }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="call">The delegate instance</param> /// <param name="instance">The ActiveRecord instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> protected static object Execute(NHibernateDelegate call, object instance) { return(Execute(typeof(T), call, instance)); }
/// <summary> /// Invokes the specified delegate passing a valid /// NHibernate session. Used for custom NHibernate queries. /// </summary> /// <param name="call">The delegate instance</param> /// <param name="instance">The ActiveRecord instance</param> /// <returns>Whatever is returned by the delegate invocation</returns> public static object Execute(NHibernateDelegate call, T instance) { return(Execute(typeof(T), call, instance)); }
public static void Execute(T instnace, NHibernateDelegate call) { ActiveRecordBase.Execute(typeof(T), call, instnace); }
protected static R Execute <R>(NHibernateDelegate call) { return((R)Execute(call, null)); }