1 //------------------------------------------------------------------------------
2 // <copyright file="CompiledQueryCacheKey.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //------------------------------------------------------------------------------
10 namespace System.Data.Common.QueryCache
13 using System.Diagnostics;
15 internal sealed class CompiledQueryCacheKey : QueryCacheKey
17 private readonly Guid _cacheIdentity;
19 internal CompiledQueryCacheKey(Guid cacheIdentity)
21 _cacheIdentity = cacheIdentity;
25 /// Determines equality of this key with respect to <paramref name="compareTo"/>
27 /// <param name="otherObject"></param>
28 /// <returns></returns>
29 public override bool Equals(object compareTo)
31 Debug.Assert(compareTo != null, "Comparison key should not be null");
32 if (typeof(CompiledQueryCacheKey) != compareTo.GetType())
37 return ((CompiledQueryCacheKey)compareTo)._cacheIdentity.Equals(this._cacheIdentity);
41 /// Returns the hashcode for this cache key
43 /// <returns></returns>
44 public override int GetHashCode()
46 return _cacheIdentity.GetHashCode();
50 /// Returns a string representation of the state of this cache key
53 /// A string representation that includes query text, parameter information, include path information
54 /// and merge option information about this cache key.
56 public override string ToString()
58 return _cacheIdentity.ToString();