Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CompiledQueryCacheKey.cs « QueryCache « Common « Data « System « System.Data.Entity « referencesource « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2654fe187be2cf8bc714fd271d449bb9bc05d9ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//------------------------------------------------------------------------------
// <copyright file="CompiledQueryCacheKey.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//
// @owner  [....]
// @backupOwner [....]
//------------------------------------------------------------------------------

namespace System.Data.Common.QueryCache
{
    using System;
    using System.Diagnostics;
    
    internal sealed class CompiledQueryCacheKey : QueryCacheKey
    {
        private readonly Guid _cacheIdentity;

        internal CompiledQueryCacheKey(Guid cacheIdentity)
        {
            _cacheIdentity = cacheIdentity;
        }

        /// <summary>
        /// Determines equality of this key with respect to <paramref name="compareTo"/>
        /// </summary>
        /// <param name="otherObject"></param>
        /// <returns></returns>
        public override bool Equals(object compareTo)
        {
            Debug.Assert(compareTo != null, "Comparison key should not be null");
            if (typeof(CompiledQueryCacheKey) != compareTo.GetType())
            {
                return false;
            }

            return ((CompiledQueryCacheKey)compareTo)._cacheIdentity.Equals(this._cacheIdentity);
        }

        /// <summary>
        /// Returns the hashcode for this cache key
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return _cacheIdentity.GetHashCode();
        }

        /// <summary>
        /// Returns a string representation of the state of this cache key
        /// </summary>
        /// <returns>
        /// A string representation that includes query text, parameter information, include path information
        /// and merge option information about this cache key.
        /// </returns>
        public override string ToString()
        {
            return _cacheIdentity.ToString();
        }
    }
}