CurrentScope() 공개 정적인 메소드

Gets the current scope
public static CurrentScope ( ) : ISessionScope
리턴 ISessionScope
예제 #1
0
 /// <summary>
 /// Returns a portion of the query results (sliced)
 /// </summary>
 /// <param name="firstResult">The number of the first row to retrieve.</param>
 /// <param name="maxResults">The maximum number of results retrieved.</param>
 /// <param name="criteria">The criteria expression</param>
 /// <returns>The sliced query results.</returns>
 public static IEnumerable <T> SlicedFindAll(int firstResult, int maxResults, params ICriterion[] criteria)
 {
     return(AR.CurrentScope().SlicedFindAll <T>(firstResult, maxResults, criteria));
 }
예제 #2
0
 /// <summary>
 /// Check if any instance matches the query.
 /// </summary>
 /// <param name="detachedQuery">The query expression</param>
 /// <returns><c>true</c> if an instance is found; otherwise <c>false</c>.</returns>
 public static bool Exists(IDetachedQuery detachedQuery)
 {
     return(AR.CurrentScope().Exists <T>(detachedQuery));
 }
예제 #3
0
 /// <summary>
 /// Check if any instance matching the criteria exists in the database.
 /// </summary>
 /// <param name="expression">The queryover expression</param>
 /// <returns><c>true</c> if an instance is found; otherwise <c>false</c>.</returns>
 public static bool Exists(Expression <Func <T, bool> > expression)
 {
     return(AR.CurrentScope().Exists <T>(expression));
 }
예제 #4
0
 /// <summary>
 /// The QueryOver method is used as a Linq collection
 /// or as the in argument in a Linq expression.
 /// </summary>
 /// <remarks>You must have an open Session Scope.</remarks>
 public static IQueryOver <T, T> QueryOver()
 {
     return(AR.CurrentScope().QueryOver <T>());
 }
예제 #5
0
 /// <summary>
 /// The QueryOver method is used as a Linq collection
 /// or as the in argument in a Linq expression.
 /// </summary>
 /// <remarks>You must have an open Session Scope.</remarks>
 public static IQueryOver <T, T> QueryOver(string entityname)
 {
     return(AR.CurrentScope().QueryOver <T>(entityname));
 }
예제 #6
0
 /// <summary>
 /// Refresh the instance from the database.
 /// </summary>
 public virtual void Refresh()
 {
     AR.CurrentScope().Refresh(this as T);
 }
예제 #7
0
 /// <summary>
 /// Evict the instance from scope session
 /// </summary>
 public virtual void Evict()
 {
     AR.CurrentScope().Evict <T>(this as T);
 }
예제 #8
0
 /// <summary>
 /// Deletes all rows for the specified ActiveRecord type that matches
 /// the supplied criteria
 /// </summary>
 public static void DeleteAll(params ICriterion[] criteria)
 {
     AR.CurrentScope().DeleteAll <T>(criteria);
 }
예제 #9
0
 /// <summary>
 /// Deletes all rows for the specified ActiveRecord type that matches
 /// the supplied expression criteria
 /// </summary>
 public static void DeleteAll(Expression <Func <T, bool> > expression)
 {
     AR.CurrentScope().DeleteAll <T>(expression);
 }
예제 #10
0
 /// <summary>
 /// Returns a portion of the query results (sliced)
 /// </summary>
 /// <param name="firstResult">The number of the first row to retrieve.</param>
 /// <param name="maxResults">The maximum number of results retrieved.</param>
 /// <param name="queryover">Queryover</param>
 /// <returns>The sliced query results.</returns>
 public static IEnumerable <T> SlicedFindAll(int firstResult, int maxResults, QueryOver <T, T> queryover)
 {
     return(AR.CurrentScope().SlicedFindAll <T>(firstResult, maxResults, queryover));
 }
예제 #11
0
 /// <summary>
 /// Deletes all rows for the specified ActiveRecord type that matches
 /// the supplied criteria
 /// </summary>
 public static void DeleteAll(DetachedCriteria criteria)
 {
     AR.CurrentScope().DeleteAll <T>(criteria);
 }
예제 #12
0
 /// <summary>
 /// Returns a portion of the query results (sliced)
 /// </summary>
 /// <param name="firstResult">The number of the first row to retrieve.</param>
 /// <param name="maxResults">The maximum number of results retrieved.</param>
 /// <returns>The sliced query results.</returns>
 /// <param name="detachedQuery">The query expression</param>
 public static IEnumerable <T> SlicedFindAll(int firstResult, int maxResults, IDetachedQuery detachedQuery)
 {
     return(AR.CurrentScope().SlicedFindAll <T>(firstResult, maxResults, detachedQuery));
 }
예제 #13
0
 /// <summary>
 /// Finds an object instance by its primary key
 /// returns null if not found
 /// </summary>
 /// <param name="id">Identifier value</param>
 public static T Find(object id)
 {
     return(AR.CurrentScope().Find <T>(id));
 }
예제 #14
0
 /// <summary>
 /// Returns a portion of the query results (sliced)
 /// </summary>
 /// <param name="firstResult">The number of the first row to retrieve.</param>
 /// <param name="maxResults">The maximum number of results retrieved.</param>
 /// <param name="orders">An <see cref="Array"/> of <see cref="Order"/> objects.</param>
 /// <param name="criteria">The criteria expression</param>
 /// <returns>The sliced query results.</returns>
 public static IEnumerable <T> SlicedFindAll(int firstResult, int maxResults, DetachedCriteria criteria, params Order[] orders)
 {
     return(AR.CurrentScope().SlicedFindAll <T>(firstResult, maxResults, criteria, orders));
 }
예제 #15
0
 /// <summary>
 /// Persists the modification on the instance
 /// state to the database.
 /// </summary>
 public virtual void Update(bool flush = true)
 {
     AR.CurrentScope().Update(this as T, flush);
 }
예제 #16
0
 /// <summary>
 /// Deletes all rows for the specified ActiveRecord type that matches
 /// the supplied queryover
 /// </summary>
 public static void DeleteAll(QueryOver <T, T> queryover)
 {
     AR.CurrentScope().DeleteAll <T>(queryover);
 }
예제 #17
0
 /// <summary>
 /// Deletes the instance from the database.
 /// </summary>
 public virtual void Delete(bool flush = true)
 {
     AR.CurrentScope().Delete(this as T, flush);
 }
예제 #18
0
 /// <summary>
 /// Deletes all rows for the specified ActiveRecord type that matches
 /// the supplied HQL condition
 /// </summary>
 /// <param name="where">HQL condition to select the rows to be deleted</param>
 public static void DeleteAll(string where)
 {
     AR.CurrentScope().DeleteAll <T>(where);
 }
예제 #19
0
 /// <summary>
 /// Merge the instance to scope session
 /// </summary>
 public virtual void Merge()
 {
     AR.CurrentScope().Merge(this as T);
 }
예제 #20
0
 /// <summary>
 /// Deletes all <typeparamref name="T"/> objects, based on the primary keys
 /// supplied on <paramref name="pkValues" />.
 /// </summary>
 /// <returns>The number of objects deleted</returns>
 public static void DeleteAll(IEnumerable <object> pkValues)
 {
     AR.CurrentScope().DeleteAll <T>(pkValues);
 }
예제 #21
0
 /// <summary>
 /// From NHibernate documentation:
 /// Persist all reachable transient objects, reusing the current identifier
 /// values. Note that this will not trigger the Interceptor of the Session.
 /// </summary>
 /// <param name="replicationMode">The replication mode.</param>
 public virtual void Replicate(ReplicationMode replicationMode)
 {
     AR.CurrentScope().Replicate <T>(this as T, replicationMode);
 }
예제 #22
0
 /// <summary>
 /// Saves the instance to the database. If the primary key is unitialized
 /// it creates the instance on the database. Otherwise it updates it.
 /// <para>
 /// If the primary key is assigned, then you must invoke <see cref="Create"/>
 /// or <see cref="Update"/> instead.
 /// </para>
 /// </summary>
 public virtual void Save(bool flush = true)
 {
     AR.CurrentScope().Save(this as T, flush);
 }
예제 #23
0
 /// <summary>
 /// The QueryOver method is used as a Linq collection
 /// or as the in argument in a Linq expression.
 /// </summary>
 /// <remarks>You must have an open Session Scope.</remarks>
 public static IQueryOver <T, T> QueryOver(Expression <Func <T> > alias)
 {
     return(AR.CurrentScope().QueryOver <T>(alias));
 }
예제 #24
0
 /// <summary>
 /// Peeks for an object instance by its primary key,
 /// never returns null
 /// </summary>
 /// <param name="id">Identifier value</param>
 public static T Peek(object id)
 {
     return(AR.CurrentScope().Peek <T>(id));
 }
예제 #25
0
 /// <summary>
 /// The QueryOver method is used as a Linq collection
 /// or as the in argument in a Linq expression.
 /// </summary>
 /// <remarks>You must have an open Session Scope.</remarks>
 public static IQueryOver <T, T> QueryOver(string entityname, Expression <Func <T> > alias)
 {
     return(AR.CurrentScope().QueryOver <T>(entityname, alias));
 }
예제 #26
0
 /// <summary>
 /// Saves a copy of the instance to the database. If the primary key is uninitialized
 /// it creates the instance in the database. Otherwise it updates it.
 /// <para>
 /// If the primary key is assigned, then you must invoke <see cref="Create"/>
 /// or <see cref="Update"/> instead.
 /// </para>
 /// </summary>
 /// <returns>The saved ActiveRecord instance</returns>
 public virtual T SaveCopy(bool flush = true)
 {
     return(AR.CurrentScope().SaveCopy(this as T, flush));
 }
예제 #27
0
 /// <summary>
 /// Check if any instance matches the criteria.
 /// </summary>
 /// <returns><c>true</c> if an instance is found; otherwise <c>false</c>.</returns>
 public static bool Exists(params ICriterion[] criterias)
 {
     return(AR.CurrentScope().Exists <T>(criterias));
 }
예제 #28
0
 /// <summary>
 /// Creates (Saves) a new instance to the database.
 /// </summary>
 public virtual object Create(bool flush = true)
 {
     return(AR.CurrentScope().Create(this as T, flush));
 }
예제 #29
0
 /// <summary>
 /// Check if any instance matching the criteria exists in the database.
 /// </summary>
 /// <param name="queryover">The queryover expression</param>
 /// <returns><c>true</c> if an instance is found; otherwise <c>false</c>.</returns>
 public static bool Exists(QueryOver <T, T> queryover)
 {
     return(AR.CurrentScope().Exists <T>(queryover));
 }
예제 #30
0
 /// <summary>
 /// Returns all instances found for the specified type according to the criteria
 /// </summary>
 /// <param name="detachedQuery">The query expression.</param>
 /// <returns>All entities that match the query</returns>
 public static IEnumerable <T> FindAll(IDetachedQuery detachedQuery)
 {
     return(AR.CurrentScope().FindAll <T>(detachedQuery));
 }