This library helps you to start using matrix parameters (or matrix URIs) in the route of API action.
services.AddControllers(options =>{options.ModelBinderProviders.Insert(0,newSegmentPrefixAttributeModelBinderProvider());options.ModelBinderProviders.Insert(1,newMatrixParameterAttributeModelBinderProvider());});services.AddRouting(options =>{options.ConstraintMap.Add("SegmentPrefix",typeof(SegmentPrefixConstraint));});services.AddSwaggerGen(c =>{c.ParameterFilter<MatrixParameterFilter>();c.DocumentFilter<MatrixDocumentFilter>();});// GET customers/2/bananas;color=yellow,green;rate=good/oregon//// This route with the segments {fruits} and {location} will match a path with two segments if they are not // matched with the following two actions GetApplesFromWashington and GetApplesFromLocation. Both of their // routes are more specific because of constraints, and thus matched prior to this.[HttpGet][Route("{fruits}/{location}")]publicIActionResultGetFruitsFromLocation([SegmentPrefix]stringfruits,// The fruits from the route segment {fruits}.[MatrixParameter("bananas")]string[]color,// The matrix parameter color from the segment starting with "bananas". It is matched only if the fruits is "apples".[SegmentPrefix]stringlocation,// The location from the route segment {location}.[MatrixParameter("{fruits}")]string[]rate)// The matrix parameter rate from the route segment "{fruits}".{varresult=newDictionary<string,string>{{"fruits",fruits},{"color of bananas",Join(color)},{"location",location},{"rate of "+fruits,Join(rate)}};returnOk(result);}