Microsoft.Practices.Prism.Regions.RegionAdapterMappings.GetMapping C# (CSharp) Method

GetMapping() private method

private GetMapping ( Type controlType ) : IRegionAdapter
controlType System.Type
return IRegionAdapter
        public IRegionAdapter GetMapping(Type controlType)
        {
            Type currentType = controlType;

            while (currentType != null)
            {
                if (mappings.ContainsKey(currentType))
                {
                    return mappings[currentType];
                }
                currentType = currentType.BaseType;
            }
            throw new KeyNotFoundException(String.Format(CultureInfo.CurrentCulture, Resources.NoRegionAdapterException, controlType));
        }
    }

Usage Example

        public void ShouldGetMappingForDerivedTypesThanTheRegisteredOnes()
        {
            var regionAdapterMappings = new RegionAdapterMappings();
            var regionAdapter = new MockRegionAdapter();

            regionAdapterMappings.RegisterMapping(typeof(ItemsControl), regionAdapter);
            var returnedAdapter = regionAdapterMappings.GetMapping(typeof(ItemsControlDescendant));

            Assert.IsNotNull(returnedAdapter);
            Assert.AreSame(regionAdapter, returnedAdapter);
        }
All Usage Examples Of Microsoft.Practices.Prism.Regions.RegionAdapterMappings::GetMapping
RegionAdapterMappings