4b47edc6e0ab73c9cb2a7ecad32df3c88a5f55d1
[mono.git] / mcs / class / referencesource / System.Data.Entity / System / Data / Common / QueryCache / ShaperFactoryQueryCacheKey.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="ShaperFactoryQueryCacheKey.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner  [....]
7 // @backupOwner [....]
8 //------------------------------------------------------------------------------
9
10 using System.Diagnostics;
11 using System.Data.Objects;
12 namespace System.Data.Common.QueryCache
13 {
14     internal class ShaperFactoryQueryCacheKey<T> : QueryCacheKey
15     {
16         private readonly string _columnMapKey;
17         private readonly MergeOption _mergeOption;
18         private readonly bool _isValueLayer;
19
20         internal ShaperFactoryQueryCacheKey(string columnMapKey, MergeOption mergeOption, bool isValueLayer)
21         {
22             Debug.Assert(null != columnMapKey, "null columnMapKey");
23             _columnMapKey = columnMapKey;
24             _mergeOption = mergeOption;
25             _isValueLayer = isValueLayer;
26         }
27
28         public override bool Equals(object obj)
29         {
30             var other = obj as ShaperFactoryQueryCacheKey<T>;
31             if (null == other)
32             {
33                 return false;
34             }
35             return this._columnMapKey.Equals(other._columnMapKey, _stringComparison)
36                 && this._mergeOption == other._mergeOption
37                 && this._isValueLayer == other._isValueLayer;
38         }
39
40         public override int GetHashCode()
41         {
42             return _columnMapKey.GetHashCode();
43         }
44     }
45 }