ploeh / Hyprlinkr

A URI building helper library for ASP.NET Web API
MIT License
197 stars 34 forks source link

How do I use hyprlinkr in a non-typesafe manner? #32

Closed smolesen closed 10 years ago

smolesen commented 10 years ago

Working on a project, where controllers are being registered at startup time... Ie. I don't know which controllers actually exist at compiletime....

However, when using hyprlinkr I have to supply the controllertype to the GetUri method. Is there a non-typsafe way of calling GetUri ?

/Søren

ploeh commented 10 years ago

There isn't a non-type-safe way of calling GetUri - I'm not sure there would be any point...

The point of Hyprlinkr is basically to be a type-safe wrapper around UrlHelper.Route, but if you don't need the type-safety, would Hyprlinkr add any value?

smolesen commented 10 years ago

In most cases the Links I need are within the same assembly, where the type-safe way works very well, but in some cases I need to create links to controllers in another assembly, which are loaded at startup...being able to use hyprlinkr would give me a more or less consistent way of creating both types of links.

...

ploeh commented 10 years ago

Assuming that I were to add a non-type-safe method to Hyprlinkr, what would it look like?

Without type information, you'll not be able to provide a lambda expression...