Custom module with long strings in a field

Posted by Community Admin on 04-Aug-2018 16:35

Custom module with long strings in a field

All Replies

Posted by Community Admin on 21-Feb-2012 00:00

Hi,
I've been experimenting with a custom module based on one of Josh Morales' posts.  I want to add a custom field called LeadText, but I'd like it to be able to persist something longer than 256 characters. 

At first, I tried this:

/// <summary>
/// LeadText.  A summary version of the main content.
/// </summary>
[DataMember]
public string LeadText
    get return this.leadText;
    set this.leadText = value;

But discovered that the text was truncated (actually, I get an ORM error warning of the truncation).  So I decorated the attribute like this:
/// <summary>
/// LeadText.  A summary version of the main content.
/// </summary>
[DataMember]
[UserFriendlyDataType(UserFriendlyDataType.LongText)]
public string LeadText
    get return this.leadText;
    set this.leadText = value;

However, this has no effect--I still get the warning about truncation. 

How do I create a new field that is a long text field?  Or, if this is the correct approach, does OpenAccess upgrade a short text to a long text field, like Nolics did in 3.x?

Thanks,
Mike Sharp


Posted by Community Admin on 21-Feb-2012 00:00

Ah, never mind. I realized I needed to update the Fluent mapping as well. 


    itemMapping.HasProperty(p => p.LeadText).IsLongText(
this.Context).IsNullable();

This worked fine.

Thanks,
Mike

This thread is closed