/// <summary>Adds an or get batch.</summary>
        /// <param name="context">The context.</param>
        /// <returns>A FutureQueryBatch.</returns>
        public static QueryFutureBatch AddOrGetBatch(ObjectContext context)
        {
            var key      = RuntimeHelpers.GetHashCode(context).ToString();
            var newQuery = new QueryFutureBatch(context);

            return((QueryFutureBatch)Cache.AddOrGetExisting(key, newQuery, DefaultCacheItemPolicy) ?? newQuery);
        }
示例#2
0
        public static QueryFutureBatch AddOrGetBatch(DbContext context)
#endif
        {
            QueryFutureBatch futureBatch;

            if (!CacheWeakFutureBatch.TryGetValue(context, out futureBatch))
            {
                futureBatch = new QueryFutureBatch(context);
                CacheWeakFutureBatch.Add(context, futureBatch);
            }

            return(futureBatch);
        }
        public static QueryFutureBatch AddOrGetBatch(DbContext context)
#endif
        {
            QueryFutureBatch futureBatch;

            if (!CacheWeakFutureBatch.TryGetValue(context, out futureBatch))
            {
                futureBatch = new QueryFutureBatch(context);
                CacheWeakFutureBatch.Add(context, futureBatch);
            }

            return futureBatch;
        }
        public QueryFutureValue(QueryFutureBatch ownerBatch, IQueryable query)
#endif
        {
            OwnerBatch = ownerBatch;
            Query      = query;
        }
        /// <summary>Constructor.</summary>
        /// <param name="ownerBatch">The batch that owns this item.</param>
        /// <param name="query">
        ///     The query to defer the execution and to add in the batch of future
        ///     queries.
        /// </param>
#if EF5 || EF6
        public QueryFutureValue(QueryFutureBatch ownerBatch, ObjectQuery query)
示例#6
0
        /// <summary>Constructor.</summary>
        /// <param name="ownerBatch">The batch that owns this item.</param>
        /// <param name="query">
        ///     The query to defer the execution and to add in the batch of future
        ///     queries.
        /// </param>
#if EF5 || EF6
        public QueryFutureEnumerable(QueryFutureBatch ownerBatch, ObjectQuery <T> query)
示例#7
0
 /// <summary>Constructor.</summary>
 /// <param name="ownerBatch">The batch that owns this item.</param>
 /// <param name="query">The query.</param>
 public QueryFutureEnumerable(QueryFutureBatch ownerBatch, ObjectQuery <T> query)
 {
     OwnerBatch = ownerBatch;
     Query      = query;
 }
 /// <summary>Removes the batch described by context.</summary>
 /// <param name="batch">The context.</param>
 public static void RemoveBatch(QueryFutureBatch batch)
 {
     var key = RuntimeHelpers.GetHashCode(batch.Context).ToString();
     Cache.Remove(key);
 }
 /// <summary>Adds an or get batch.</summary>
 /// <param name="context">The context.</param>
 /// <returns>A FutureQueryBatch.</returns>
 public static QueryFutureBatch AddOrGetBatch(ObjectContext context)
 {
     var key = RuntimeHelpers.GetHashCode(context).ToString();
     var newQuery = new QueryFutureBatch(context);
     return (QueryFutureBatch) Cache.AddOrGetExisting(key, newQuery, DefaultCacheItemPolicy) ?? newQuery;
 }
 /// <summary>Constructor.</summary>
 /// <param name="ownerBatch">The batch that owns this item.</param>
 /// <param name="query">The query.</param>
 public QueryFutureValue(QueryFutureBatch ownerBatch, ObjectQuery query)
 {
     OwnerBatch = ownerBatch;
     Query      = query;
 }
        /// <summary>Removes the batch described by context.</summary>
        /// <param name="batch">The context.</param>
        public static void RemoveBatch(QueryFutureBatch batch)
        {
            var key = RuntimeHelpers.GetHashCode(batch.Context).ToString();

            Cache.Remove(key);
        }