Quantcast
Channel: RazorGenerator Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 525

Created Issue: PreemptPhysicalFiles ignored on partial views [100]

$
0
0
The PreemptPhysicalFiles = false works for views, but when RenderPartial is called the cshtml file from assembly is used even the file exist on disk.

There is missing condition for PreemptPhysicalFiles in FileExists, but the condition is present in CreateInstance. I fixed it by overriding the FileExists method.

```
public class PrecompiledMvcEngineFixed : PrecompiledMvcEngine
{
protected override bool FileExists(ControllerContext controllerContext, string virtualPath)
{
if (!PreemptPhysicalFiles && VirtualPathProvider.FileExists(virtualPath))
{
// If the physical file on disk exist and the user's opted in this behavior, serve it instead.
return false;
}
return base.FileExists(controllerContext, virtualPath);
}
}
```

Note that it works OK when engine is added at the end:
```
ViewEngines.Engines.Add(engine);
```
However it does not work when engine is put at the 1st place:
```
ViewEngines.Engines.Insert(0,engine);
```

Viewing all articles
Browse latest Browse all 525

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>