I tried to create a
VirtualPathProvider and set the scene as an embedded resource. Class assembly resource virtual file: VirtualFile {string path; Public Assembly ResourceVipual File (String Virtual Peth): Base (Virtual Peth) {Path = Virtual Path Utility. Tap indispensable (virtualpath); } Public override system.io.stream open () {string [] parts = path. Sample ('/'); String assembly name = parts [2]; String resource name = parts [3]; AssemblyName = Path. Cobain (http.time directory, assembly name); Var assembly = assembly Loadfile (assembly name); If (assembly! = Null) {return assembly. GetManifestResourceStream (resourceName); } Return tap; }} and
public class assembly resource resources: systems. Web. Hosting Virtual Pathfather (Public Assembly Resources Resources) () {} Private Clause IsAppResourcePath (String Virtual Path) {String Checkpath = Virtual Pathupility. Tap indispensable (virtualpath); Return check path. Start ("~ / App_Resource /", String Comparison. Invent Culture Ignore Case); } Public override bool fileexists (virtual path string) {returns (ISPRSOSCRPRP (virtualpath)} base.filexists (virtualpath); } Public override virtualfile GetFile (Virtual Path String) {if (IsAppResourcePath (Virtual Peth)) returns new assembly ResourceVipualFile (virtualpath); Second base back. Gatefile (virtual path); } Public override cache dependency GetCacheDependency (String Virtual Path, IEnumerable virtualPathDependencies, DateTime utcStart) {If (IsAppResourcePath (virtualpath)) return tap; And in turn the base. GateCoachApplication (Virtual Path, Virtual Path Dependence, UtStart); }} My Controller
See Return ("~ / App_Resource / Blog.DLL / Blog.Views.Blog.Latest.cshtml"); Finds this view, but I get this error:
... view.cshtml 'should be received from the webview page, or from the webview page & Lt; TModel & gt; When trying to show a partial view using
:
@ {Html.RenderAction ("latest", "blog"); }
Is there any way to fix this?
Or is there a easy way to store ideas on a DLL?
Why this happens because you are now serving razor ideas from unknown places standard ~ / Views / web.config is no longer applicable, then you have a @ Inherits system within your custom ideas. Web. MVC WebView but it can be quite a hassle. You can checkout.
Comments
Post a Comment