Exemple #1
0
        private SqlQueryCache(SqlQueryIdentity identity, SqlQueryBuilder builder)
            : base(builder.DefaultCapacity, builder.DefaultItemCapacity)
        {
            this.identity    = identity;
            this.description = builder.Description;

            var setCacheFlushMethod = new SetCacheFlushMethod(this);

            foreach (var table in builder.referencedTables)
            {
                table.InvokeTypedMethod(setCacheFlushMethod);
            }
            this.namedTablesToReactTo = (from table in builder.referencedDynamicTables select SqlDataModification.NamedTable(table)).ToList();
        }
Exemple #2
0
        internal static SqlQueryCache Get(SqlQueryBuilder builder)
        {
            var identity = new SqlQueryIdentity(builder);

            lock (Nrdo.LockObj)
            {
                SqlQueryCache result;
                if (caches.TryGetValue(identity, out result))
                {
                    return(result);
                }

                result           = new SqlQueryCache(identity, builder);
                caches[identity] = result;

                return(result);
            }
        }