/// <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
ファイル: Visitor.cs プロジェクト: PlumpMath/cilpe-1
 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;
 }