I am encountering an issue where the value of string -- stored in a Single-Line Text field -- is returned as being truncated to the first 255 characters. When I look in the Content Editor, I see the excess characters. If I query the database using Sitecore Rocks I see the extra characters.
Is it possible this is being caused by GlassMapper?
In the code samples below, it is the LinkText that is being truncated.
My models...
using Glass.Mapper.Sc.Configuration.Attributes;
using Glass.Mapper.Sc.Fields;
using MySite.Extensions;
using MySite.Models.Base;
using Sitecore.Data.Items;
using System;
namespace MySite.Models.Items
{
[SitecoreType]
public class LinkItem : ISitecoreBase, ILinkItemBase
{
// ISitecoreBase
public virtual Guid Id { get; set; }
public virtual string Path { get; set; }
public virtual Item InnerItem { get; set; }
// ILinkItemBase
public virtual string LinkText { get; set; }
public virtual Link LinkTarget { get; set; }
/// <summary>
/// Does the link have neccessary content?
/// </summary>
/// <returns></returns>
public bool IsValid()
{
return this.LinkText.HasValue();
}
}
}
using Glass.Mapper.Sc.Configuration.Attributes;
using Glass.Mapper.Sc.Fields;
using MySite.Extensions;
namespace MySite.Models.Base
{
[SitecoreType(TemplateId = Constants.TemplateIds.LINK_ITEM_BASE)]
public interface ILinkItemBase
{
[SitecoreField(Constants.LinkItemBase.LINK_TEXT)]
string LinkText { get; }
[SitecoreField(Constants.LinkItemBase.LINK_TARGET)]
Link LinkTarget { get; }
}
}
The logic snippet... by line 3 of GetLinkItems, the LinkText of the items in this.LinkItems is already showing up as truncated.
public virtual IEnumerable<LinkItem> LinkItems { get; set; }
public ICollection<LinkItem> GetLinkItems()
{
ICollection<LinkItem> linkItemCollection = new List<LinkItem>();
if (this.LinkItems.HasItems())
{
foreach (LinkItem LinkItem in this.LinkItems)
{
if (LinkItem.IsValid())
{
linkItemCollection.Add(LinkItem);
}
}
}
return linkItemCollection;
}