Files
Rest.Net/Rest.Net/RouteRequest.cs

48 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MontoyaTech.Rest.Net
{
/// <summary>
/// The outline of an attribute that defines a routes request type.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class RouteRequest : Attribute
{
/// <summary>
/// The type of the request.
/// </summary>
public Type RequestType = null;
/// <summary>
/// Whether or not the Request is Json Serialized. Default is true.
/// </summary>
public bool Json = true;
/// <summary>
/// Whether or not the request is a dynamic type. Default is false.
/// </summary>
public bool Dynamic = false;
/// <summary>
/// Creates a default route request.
/// </summary>
public RouteRequest() { }
/// <summary>
/// Creates a route request with the request type.
/// </summary>
/// <param name="requestType"></param>
public RouteRequest(Type requestType)
{
if (requestType == null)
throw new ArgumentNullException($"{nameof(requestType)} cannot be null.");
this.RequestType = requestType;
}
}
}