Webapi restriction of authority

There are a number of warnings in the documentation for attribute triggering that say " performance improvements when matching routes " does not work. What kind of performance improvements are they talking about, and what does this mean in terms of performance in the production system - is it enough to not consider the issue of attribution in the production system?

What about more details on custom route handlers and query string parameter restrictions? What do they mean by β€œregular”, and also for query restrictions, are data type restrictions?

I would like to understand this a little more, and also measure its effect in my use cases, to judge if the attribute routing package for web-api is suitable for my api product.

+4
source share
1 answer

ESSENCE

Make a rating based on beta version 5.0 for ASP.NET v5, either from source or a nightly build , as it includes the Routing attribute .

DETAIL

Merger

AttributeRouting was taken over by the ASP.NET v5 RTM platform in collaboration with package owner Tim McCall. v5 has been in beta since February 2013. See the ASP.NET Roadmap to the ASP.NET Documentation Site .

Custom Route Handlers

Parameter Limitations

Support for classes based on HttpVerbAttribute (examples from AttributeRoutingTest.cs ):

Parameter Type Constraints

[HttpGet("controller/{id:int}")] public string Get(int id) { ... } 

Extra options

  [HttpGet("optional/{opt1?}/{opt2?}")] public string Optional(string opt1 = null, string opt2 = null) { ... } 

Default for attributes

  [HttpGet("default/{default1=D1}/{default2=D2}")] public string Default(string default1, string default2) { ... } 

Wildcard Options

  [HttpGet("wildcard/{*wildcard}")] public string Wildcard(string wildcard) { ... } 
+4
source

Source: https://habr.com/ru/post/1485601/


All Articles