I have a following POCO class. I don not want the parameterless constructor to be public.
public class FileDownloadRequest
{
//public FileDownloadRequest() { }
public FileDownloadRequest(int fileId, RepositoryFolderTypes fileType) //RepositoryFolderTypes is an enum, not a class
{
this.FileId = fileId;
this.FileType = fileType;
}
public int FileId { get; set; }
public RepositoryFolderTypes FileType { get; set; } //an enum
}
When I am trying a https://10.27.8.6/Files/DownloadFile?fileId=1&folderType=SRC
request to the following controller action, I get an error saying that no parameterless constructor exists for this object.
[HttpGet]
public async Task<HttpResponseMessage> DownloadFile([FromUri] FileDownloadRequest request)
{
}
Is it possible to have a non-public constructor, or is a public one absolutely required?