private static void AddCommentsToFieldProperty(CodeMemberProperty property, ITemplateFieldInfo field)
 {
     if (!string.IsNullOrEmpty(field.HelpText))
         property.Comments.Add(new CodeCommentStatement("<summary>" + field.HelpText + "</summary>", true));
     else
         property.Comments.Add(new CodeCommentStatement(string.Format("<summary>Represents the {0} field</summary>", field.DisplayName), true));
 }
Esempio n. 2
0
 private static void AddCommentsToFieldProperty(CodeMemberProperty property, ITemplateFieldInfo field)
 {
     if (!string.IsNullOrEmpty(field.HelpText))
     {
         property.Comments.Add(new CodeCommentStatement("<summary>" + field.HelpText + "</summary>", true));
     }
     else
     {
         property.Comments.Add(new CodeCommentStatement(string.Format("<summary>Represents the {0} field</summary>", field.DisplayName), true));
     }
 }
        public FieldMapping GetFieldType(ITemplateFieldInfo templateField)
        {
            Assert.ArgumentNotNull(templateField, "templateField");

            FieldMapping fieldType = GetTemplateMapping(templateField);

            if (fieldType != null)
            {
                return(fieldType);
            }

            if (_fieldMappings.TryGetValue(templateField.Type, out fieldType))
            {
                return(fieldType);
            }

            return(new FieldMapping(typeof(ITextField), typeof(TextField)));            // if no mapping, fall back to a text field
        }
        private FieldMapping GetTemplateMapping(ITemplateFieldInfo templateField)
        {
            Assert.ArgumentNotNull(templateField, "templateField");

            TemplateMapping templateMapping;
            FieldMapping    fieldMapping;

            // template map by TID
            _templateMappings.TryGetValue(templateField.Template.TemplateId.ToString(), out templateMapping);

            // template map by full path
            if (templateMapping == null)
            {
                _templateMappings.TryGetValue(templateField.Template.FullPath, out templateMapping);
            }

            // template map by name
            if (templateMapping == null)
            {
                _templateMappings.TryGetValue(templateField.Template.Name, out templateMapping);
            }

            if (templateMapping == null)
            {
                return(null);
            }

            if (templateMapping.TryGetValue(templateField.Id.ToString(), out fieldMapping))
            {
                return(fieldMapping);
            }

            if (templateMapping.TryGetValue(templateField.Name, out fieldMapping))
            {
                return(fieldMapping);
            }

            return(null);
        }
Esempio n. 5
0
		public FieldPropertyInfo(ITemplateFieldInfo field)
		{
			_field = field;
		}
Esempio n. 6
0
 public FieldPropertyInfo(ITemplateFieldInfo field)
 {
     Field = field;
 }
 public virtual string MapToSearchField(ITemplateFieldInfo field)
 {
     // this seems to work just fine across Solr and Lucene
     // using something else? Patch in a different one.
     return(field.Name.Replace(" ", "_").ToLowerInvariant());
 }