/// <summary>
        /// Tranform <see cref="DisplayMetadata"/>
        /// </summary>
        /// <param name="metadata"></param>
        /// <param name="identity"></param>
        public static void Transform([NotNull] DisplayMetadata metadata, ModelMetadataIdentity identity)
        {
            Invariant.IsNotNull(metadata, "metadata");
            Invariant.IsNotNull(identity, "identity");

            if (identity.ContainerType == null || string.IsNullOrEmpty(identity.Name))
            {
                return;
            }

            var containerType = identity.ContainerType;
            // fluent configuration does not have ResourceType, so get it from type
            var resourceType = LocalizationConventions.GetDefaultResourceType(containerType);
            var propertyName = identity.Name;

            if (resourceType != null && !string.IsNullOrEmpty(propertyName))
            {
                var key = ResourceUtil.GetResourceKey(containerType, propertyName);
                if (metadata.DisplayName == null)
                {
                    metadata.DisplayName = RetrieveValue(resourceType, key, propertyName);
                }

                if (metadata.SimpleDisplayProperty == null)
                {
                    metadata.SimpleDisplayProperty = RetrieveValue(resourceType, key + ShortDisplayNameSuffix, propertyName + ShortDisplayNameSuffix)();
                }

                if (metadata.Placeholder == null)
                {
                    metadata.Placeholder = RetrieveValue(resourceType, key + PlaceholderSuffix, propertyName + PlaceholderSuffix);
                }

                if (metadata.Description == null)
                {
                    metadata.Description = RetrieveValue(resourceType, key + DescriptionSuffix, propertyName + DescriptionSuffix);
                }
            }
        }
예제 #2
0
파일: State.cs 프로젝트: PlumpMath/cilpe-1
 protected override void VisitRetrieveValue(RetrieveValue node, object data)
 {
     throw new NodeNotSupportedException(node);
 }
예제 #3
0
 protected internal override void VisitRetrieveValue(RetrieveValue node, object data)
 {
     throw new VerifierException();
     //not supported yet...
 }
예제 #4
0
 protected internal virtual void VisitRetrieveValue(RetrieveValue node, object data)
 {
     throw new NodeNotSupportedException(node);
 }
예제 #5
0
 public TypeInformation(RetrieveValue retriever, IdGenerator generator)
 {
     this.retriever = retriever;
     this.generator = generator;
 }