/// <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); } } }
protected override void VisitRetrieveValue(RetrieveValue node, object data) { throw new NodeNotSupportedException(node); }
protected internal override void VisitRetrieveValue(RetrieveValue node, object data) { throw new VerifierException(); //not supported yet... }
protected internal virtual void VisitRetrieveValue(RetrieveValue node, object data) { throw new NodeNotSupportedException(node); }
public TypeInformation(RetrieveValue retriever, IdGenerator generator) { this.retriever = retriever; this.generator = generator; }