Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FromUriAttribute replacement in ASP.NET Core - specifically for parameter aliasing?

I have an MVC Controller with the following API:

public CustomObject Get([FromUri] float lat, [FromUri(Name="long")] float longitude, string userKey = null)

This works, but requires the compatibility shim since FromUri is deprecated.

How do I replicate the "aliasing" behavior of the longitude parameter with proper ASP.NET Core API?

like image 858
Malachi Avatar asked May 02 '16 03:05

Malachi


1 Answers

Use the Bind Attribute as an alternative solution

public CustomObject Get(float lat, [Bind(Prefix = "long")]float longitude, string userKey = null)
like image 134
RedJandal Avatar answered Nov 06 '22 23:11

RedJandal