Exemplo n.º 1
0
        /// <summary>
        /// Get the {@link CollectionLoadContext} associated with the given
        /// {@link ResultSet}, creating one if needed.
        /// </summary>
        /// <param name="resultSet">The result set for which to retrieve the context. </param>
        /// <returns> The processing context. </returns>
        public CollectionLoadContext GetCollectionLoadContext(DbDataReader resultSet)
        {
            CollectionLoadContext context = null;

            if (collectionLoadContexts == null)
            {
                collectionLoadContexts = IdentityMap.Instantiate(8);
            }
            else
            {
                context = (CollectionLoadContext)collectionLoadContexts[resultSet];
            }
            if (context == null)
            {
                if (log.IsDebugEnabled())
                {
                    // Do not log the resultSet as-is, it is an IEnumerable which may get enumerated by loggers.
                    // (Serilog does that.) See #1667.
                    log.Debug("constructing collection load context for result set [{0}]", resultSet.GetType());
                }
                context = new CollectionLoadContext(this, resultSet);
                collectionLoadContexts[resultSet] = context;
            }
            return(context);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Release internal state associated with the given result set.
 ///  </summary>
 /// <param name="resultSet">The result set for which it is ok to release associated resources. </param>
 /// <remarks>
 /// This should be called when we are done with processing said result set,
 /// ideally as the result set is being closed.
 /// </remarks>
 public virtual void Cleanup(DbDataReader resultSet)
 {
     if (collectionLoadContexts != null)
     {
         CollectionLoadContext collectionLoadContext = (CollectionLoadContext)collectionLoadContexts[resultSet];
         collectionLoadContext.Cleanup();
         collectionLoadContexts.Remove(resultSet);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Get the {@link CollectionLoadContext} associated with the given
        /// {@link ResultSet}, creating one if needed.
        /// </summary>
        /// <param name="resultSet">The result set for which to retrieve the context. </param>
        /// <returns> The processing context. </returns>
        public CollectionLoadContext GetCollectionLoadContext(DbDataReader resultSet)
        {
            CollectionLoadContext context = null;

            if (collectionLoadContexts == null)
            {
                collectionLoadContexts = IdentityMap.Instantiate(8);
            }
            else
            {
                context = (CollectionLoadContext)collectionLoadContexts[resultSet];
            }
            if (context == null)
            {
                if (log.IsDebugEnabled())
                {
                    log.Debug("constructing collection load context for result set [{0}]", resultSet);
                }
                context = new CollectionLoadContext(this, resultSet);
                collectionLoadContexts[resultSet] = context;
            }
            return(context);
        }
Exemplo n.º 4
0
		/// <summary> 
		/// Get the {@link CollectionLoadContext} associated with the given
		/// {@link ResultSet}, creating one if needed. 
		/// </summary>
		/// <param name="resultSet">The result set for which to retrieve the context. </param>
		/// <returns> The processing context. </returns>
		public CollectionLoadContext GetCollectionLoadContext(IDataReader resultSet)
		{
			CollectionLoadContext context = null;
			if (collectionLoadContexts == null)
			{
				collectionLoadContexts = IdentityMap.Instantiate(8);
			}
			else
			{
				context = (CollectionLoadContext)collectionLoadContexts[resultSet];
			}
			if (context == null)
			{
				if (log.IsDebugEnabled)
				{
					log.Debug("constructing collection load context for result set [" + resultSet + "]");
				}
				context = new CollectionLoadContext(this, resultSet);
				collectionLoadContexts[resultSet] = context;
			}
			return context;
		}