You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe the problem.
I am working with typed ids:
public readonly record struct FooId(Guid Value);
If I use this value as a route parameter value and do not override ToStringit is converted to string as FooId { Value = '....' }. That is obviously not what I want to have in a generated URL.
IMO, framework should not force my types to have a certain behavior. Writing parameter value to a URL is effectively a serialization, hence there should be the same level of flexibility/extensibility.
While framework offers outbound parameter transformers, they are not connected to the types of parameter values.
Describe the solution you'd like
I'd like ASP.NET to introduce a specific interface:
public interface IRouteParaemterValueStringConverter<TParameterValue>
{
string Convert(TParameterValue value);
}
Its default implementation can just convert to string.