示例#1
0
        private MetadataContentModel ProcessMetaData(ModelMetadata metadata)
        {
            var model = new MetadataContentModel();

            model.ConvertEmptyStringToNull.Value = metadata.ConvertEmptyStringToNull;
            model.DataTypeName.Value             = metadata.DataTypeName;
            model.Description.Value         = metadata.Description;
            model.DisplayFormatString.Value = metadata.DisplayFormatString;
            model.DisplayName.Value         = metadata.DataTypeName;
            model.HideSurroundingHtml.Value = metadata.HideSurroundingHtml;
            model.IsComplexType.Value       = metadata.IsComplexType;
            model.IsNullableValueType.Value = metadata.IsNullableValueType;
            model.IsReadOnly.Value          = metadata.IsReadOnly;
            model.IsRequired.Value          = metadata.IsRequired;
            model.IsRequired.Default        = metadata.IsNullableValueType;
            model.NullDisplayText.Value     = metadata.NullDisplayText;
            model.ShortDisplayName.Value    = metadata.ShortDisplayName;
            model.ShowForDisplay.Value      = metadata.ShowForDisplay;
            model.ShowForEdit.Value         = metadata.ShowForEdit;
            model.SimpleDisplayText.Value   = metadata.SimpleDisplayText;
            model.TemplateHint.Value        = metadata.TemplateHint;
            model.Watermark.Value           = metadata.Watermark;

            return(model);
        }
        private object ConvertMetadata(MetadataContentModel metadata)
        {
            if (metadata == null)
            {
                return(null);
            }

            var section = new TabObject();

            section.AddRow().Key("ConvertEmptyStringToNull").Value(metadata.ConvertEmptyStringToNull.Value).StrongIf(!metadata.ConvertEmptyStringToNull.IsDefault());
            section.AddRow().Key("DataTypeName").Value(metadata.DataTypeName.Value).StrongIf(!metadata.DataTypeName.IsDefault());
            section.AddRow().Key("Description").Value(metadata.Description.Value).StrongIf(!metadata.Description.IsDefault());
            section.AddRow().Key("DisplayFormatString").Value(metadata.DisplayFormatString.Value).StrongIf(!metadata.DisplayFormatString.IsDefault());
            section.AddRow().Key("DisplayName").Value(metadata.DisplayName.Value).StrongIf(!metadata.DisplayName.IsDefault());
            section.AddRow().Key("EditFormatString").Value(metadata.EditFormatString.Value).StrongIf(!metadata.EditFormatString.IsDefault());
            section.AddRow().Key("HideSurroundingHtml").Value(metadata.HideSurroundingHtml.Value).StrongIf(!metadata.HideSurroundingHtml.IsDefault());
            section.AddRow().Key("IsComplexType").Value(metadata.IsComplexType.Value).StrongIf(!metadata.IsComplexType.IsDefault());
            section.AddRow().Key("IsNullableValueType").Value(metadata.IsNullableValueType.Value).StrongIf(!metadata.IsNullableValueType.IsDefault());
            section.AddRow().Key("IsReadOnly").Value(metadata.IsReadOnly.Value).StrongIf(!metadata.IsReadOnly.IsDefault());
            section.AddRow().Key("IsRequired").Value(metadata.IsRequired.Value).StrongIf(!metadata.IsRequired.IsDefault());
            section.AddRow().Key("NullDisplayText").Value(metadata.NullDisplayText.Value).StrongIf(!metadata.NullDisplayText.IsDefault());
            section.AddRow().Key("Order").Value(metadata.Order.Value).StrongIf(!metadata.Order.IsDefault());
            section.AddRow().Key("ShortDisplayName").Value(metadata.ShortDisplayName.Value).StrongIf(!metadata.ShortDisplayName.IsDefault());
            section.AddRow().Key("ShowForDisplay").Value(metadata.ShowForDisplay.Value).StrongIf(!metadata.ShowForDisplay.IsDefault());
            section.AddRow().Key("ShowForEdit").Value(metadata.ShowForEdit.Value).StrongIf(!metadata.ShowForEdit.IsDefault());
            section.AddRow().Key("SimpleDisplayText").Value(metadata.SimpleDisplayText.Value).StrongIf(!metadata.SimpleDisplayText.IsDefault());
            section.AddRow().Key("TemplateHint").Value(metadata.TemplateHint.Value).StrongIf(!metadata.TemplateHint.IsDefault());
            section.AddRow().Key("Watermark").Value(metadata.Watermark.Value).StrongIf(!metadata.Watermark.IsDefault());

            return(section);
        }