コード例 #1
0
        private IIdentityMap GetOrCreateIdentityMap(IKey key)
        {
            if (_identityMap0 == null)
            {
                _identityMap0 = key.GetIdentityMapFactory()();
                return(_identityMap0);
            }

            if (_identityMap0.Key == key)
            {
                return(_identityMap0);
            }

            if (_identityMap1 == null)
            {
                _identityMap1 = key.GetIdentityMapFactory()();
                return(_identityMap1);
            }

            if (_identityMap1.Key == key)
            {
                return(_identityMap1);
            }

            if (_identityMaps == null)
            {
                _identityMaps = new Dictionary <IKey, IIdentityMap>();
            }

            IIdentityMap identityMap;

            if (!_identityMaps.TryGetValue(key, out identityMap))
            {
                identityMap        = key.GetIdentityMapFactory()();
                _identityMaps[key] = identityMap;
            }
            return(identityMap);
        }
コード例 #2
0
        private IIdentityMap GetOrCreateIdentityMap(IKey key)
        {
            if (_identityMap0 == null)
            {
                _identityMap0 = key.GetIdentityMapFactory()();
                return _identityMap0;
            }

            if (_identityMap0.Key == key)
            {
                return _identityMap0;
            }

            if (_identityMap1 == null)
            {
                _identityMap1 = key.GetIdentityMapFactory()();
                return _identityMap1;
            }

            if (_identityMap1.Key == key)
            {
                return _identityMap1;
            }

            if (_identityMaps == null)
            {
                _identityMaps = new Dictionary<IKey, IIdentityMap>();
            }

            IIdentityMap identityMap;
            if (!_identityMaps.TryGetValue(key, out identityMap))
            {
                identityMap = key.GetIdentityMapFactory()();
                _identityMaps[key] = identityMap;
            }
            return identityMap;
        }