dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.27k stars 4.73k forks source link

Add UriTemplate from WCF to .NET Core? #17085

Closed martincostello closed 4 years ago

martincostello commented 8 years ago

The UriTemplate class looks useful for scenarios with calling HTTP clients, however it is part of System.ServiceModel.dll.

Could this type (or a similar one) be moved into the core framework along the Uri class to allow it to be used more widely and in .NET Core scenarios?

khellang commented 8 years ago

I haven't really used this class much, so I'm curious; Does this class implement any level of RFC 6570? The MSDN docs doesn't seem to mention it at all.

Or is this some weird MS implementation, like NuGet's SemanticVersion? :stuck_out_tongue: If that's the case, I'd rather see a new implementation of the former, than bringing the latter over to .NET Core.

// @darrelmiller

martincostello commented 8 years ago

I don't know actually, I just stumbled across it while reading about some other stuff. Based on the examples in the documentation to looks like it would remove the need to manually build up URIs for API calls that I've written in the past, so it looks like something that does a similar job, regardless of implementation, would be a most welcome addition.

darrelmiller commented 8 years ago

That UriTemplate class is an old one back from the days of WCF REST. It is pre-6570. It does simple {x} style parameters and it has a wildcard character.

@martincostello My UriTemplates is a portable library that can be used by .Net core, if you are looking for something.

martincostello commented 8 years ago

Sold!

martincostello commented 8 years ago

Alas Tavis.UriTemplates is not strong-named, so isn't suitable for use in all the things I'd like to use it in.

khellang commented 8 years ago

@martincostello Use Strong Namer?

davidsh commented 7 years ago

Thank you for the suggestion. It is a good idea in general about having templates, but we think it belongs where it is in WCF and is not generally applicable to .NET Core.