I'm using the SelectMany
attribute in the following way:
[SelectMany(SelectionFactoryType = typeof(TagsSelectionFactory))]
public virtual string Tags { get; set; }
With the following SelectionFactory
:
public class TagsSelectionFactory : ISelectionFactory
{
public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
{
var articleTags = DataFactory.Instance.GetChildren<ArticleTagPage>(new ContentReference(18));
var tags = new List<SelectItem>();
foreach (var item in articleTags)
{
tags.Add(new SelectItem { Text = item.TagName, Value = item.ContentLink.ID });
}
return tags;
}
}
This is how I retreive the values:
var articleObjects = DataFactory.Instance.GetChildren<ArticlePage>(currentPage.ArticlesLocation);
foreach (var item in articleObjects)
{
//this is where i get the csv value
var tags = item.Tags;
}
//ArticleTagPage.cs
[ContentType(DisplayName = "ArticleTagPage", GUID = "0401929a-903a-414f-acd1-61ad11319462", Description = "")]
public class ArticleTagPage : PageData
{
[CultureSpecific]
[Display(Name = "Tag Name", Description = "", GroupName = SystemTabNames.Content, Order = 1)]
public virtual string TagName { get; set; }
}
All of the ArticleTagPage
are located under an ArticleTagsContainerPage
. The purpose is to manage each article a collection of tags, kind of like SO questions with their tags.
My problem is that once the property gets populated, it holds a comma (,
) delimited string, and this can cause a problem in cases where the data contains a comma.
Is it possible to alter the delimiter to something like a ;
or a |
, or maybe just return a collection of the selected values?