redmine-net-api icon indicating copy to clipboard operation
redmine-net-api copied to clipboard

Making limitation flexible

Open zapadi opened this issue 7 months ago • 0 comments

Discussed in https://github.com/zapadi/redmine-net-api/discussions/383

Originally posted by SebDaniViaDanubius May 5, 2025 I had a problem with the length limitation in TimeEntry class for the Comments field (255 chars). There were comments that were 471 characters long.

I was forced to hack this:

    public sealed class TimeEntry : Identifiable<TimeEntry>, ICloneable
    {
        /// <summary>
        /// Gets or sets the maximum length of comments. The default value is 255.
        /// </summary>
        public static int MaxLengthOfComments = 255;
        ...
        /// <summary>
        /// Gets or sets the short description for the entry (<see cref="MaxLengthOfComments">length is maximized</see>).
        /// </summary>
        /// <value>The comments.</value>
        public string Comments
        {
            get => comments;
            set => comments = value.Truncate(MaxLengthOfComments);
        }
        ...
    }

This way I can set the limit up to 1000 (in my code).

      TimeEntry.MaxLengthOfComments = 1000;

Someone could put this change in the master.

zapadi avatar May 29 '25 12:05 zapadi