Example #1
0
        /// <summary>
        /// Gets the localized display name of a property.
        /// </summary>
        /// <param name="propertyInformation">The <see cref="IPropertyInformation"/> for which to lookup the resource.</param>
        /// <param name="typeInformationForResourceResolution">The <see cref="ITypeInformation"/> providing the resources.</param>
        /// <returns>The localized display name.</returns>
        public string GetPropertyDisplayName(IPropertyInformation propertyInformation, ITypeInformation typeInformationForResourceResolution)
        {
            ArgumentUtility.CheckNotNull("propertyInformation", propertyInformation);
            ArgumentUtility.CheckNotNull("typeInformationForResourceResolution", typeInformationForResourceResolution);

            var mixinIntroducedPropertyInformation = propertyInformation as MixinIntroducedPropertyInformation;

            if (mixinIntroducedPropertyInformation != null)
            {
                // Note: this is only needed until there is support for interfaces in object binding,
                // or at least, until PropertyInfoAdapter can perform the FindIntefaceDeclaration lookup fast.
                // Then, the MultiLingualResourcesBasedMemberInformationGlobalizationService will be able to implement the look of the localization
                // from the class-qualified name, then the interfaces-qualified names, and finally, the unqualified name.
                var    interfaceImplementationPropertyInfo = mixinIntroducedPropertyInformation.InterfaceImplementationPropertyInfo;
                string displayNameFromInterface;
                if (_memberInformationGlobalizationService.TryGetPropertyDisplayName(
                        interfaceImplementationPropertyInfo.DeclarationPropertyInfo,
                        typeInformationForResourceResolution,
                        out displayNameFromInterface))
                {
                    return(displayNameFromInterface);
                }

                string displayNameFromImplementation;
                if (_memberInformationGlobalizationService.TryGetPropertyDisplayName(
                        interfaceImplementationPropertyInfo.ImplementationPropertyInfo,
                        typeInformationForResourceResolution,
                        out displayNameFromImplementation))
                {
                    return(displayNameFromImplementation);
                }
            }

            return(_memberInformationGlobalizationService.GetPropertyDisplayName(
                       propertyInformation.GetOriginalDeclaration(),
                       typeInformationForResourceResolution));
        }
 public IPropertyInformation GetOriginalDeclaration()
 {
     return(_implementationPropertyInfo.GetOriginalDeclaration());
 }