aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Filters/MaxContentLengthAttribute.cs
blob: 507a6404aac44cd1cff863c245d86fceeec1e0d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Microsoft.AspNetCore.Mvc;

namespace Timeline.Filters
{
    /// <summary>
    /// Restrict max content length.
    /// </summary>
    public class MaxContentLengthAttribute : TypeFilterAttribute
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="maxByteLength">Max length.</param>
        public MaxContentLengthAttribute(long maxByteLength)
            : base(typeof(MaxContentLengthFilter))
        {
            MaxByteLength = maxByteLength;
            Arguments = new object[] { maxByteLength };
        }

        /// <summary>
        /// Max length.
        /// </summary>
        public long MaxByteLength { get; }
    }
}