Nancy icon indicating copy to clipboard operation
Nancy copied to clipboard

Multiple IViewLocationProviders?

Open benjamin-hodgson opened this issue 8 years ago • 1 comments

I want to implement a custom IViewLocationProvider to put in a library. I want to set up some custom view locations for use with a custom view engine, and fall back to the default strategy when it doesn't match. This is because I want my library to coexist happily with other view engines.

However it looks like NancyInternalConfiguration only allows for a single ViewLocationProvider to be configured; it's a Type and not an IEnumerable<Type> or anything like that. My next thought was to wrap an existing IViewLocationProvider in my object and delegate to it, but there doesn't seem to be a clean way of getting hold of the default provider (it'll have been overridden by my custom one!)

NB I don't want to hard-code FileSystemViewLocationProvider as the fallback. The fallback strategy should be configurable.

Any tips?

benjamin-hodgson avatar Mar 07 '18 19:03 benjamin-hodgson

I'm looking for exactly the same thing, but don't mind writing my own IViewLocationProvider to do it. How would you go about using FileSystemViewLocationProvider by default and falling back to ResourceViewLocationProvider?

dineshpannu avatar Apr 12 '18 07:04 dineshpannu