包括在ASP.NET MVC Web应用程序pre-次编译 [英] Including Pre-Compiled Views in an ASP.NET MVC Web Application

查看:75
本文介绍了包括在ASP.NET MVC Web应用程序pre-次编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

包括一个ASP.NET MVC Web应用程序pre-编译次数

Including Pre-Compiled Views in an ASP.NET MVC Web Application

参考

请参见上文博客。我试图创造MVC 3用户控件的类库。
参照上述博客我已经创造了它类库写视图。
但问题是,如何注册在我的消费者应用程序的部分观点,看法。
precompiledMvc​​Engine不在的NuGet找到。这将注册在asp.net MVC应用程序precompiled视图。

please see above blog. am trying to create class library of user control in MVC 3. with reference to above blog i have created class library write view in it. but problem is how to register that view in my consumer application as partial view. PrecompiledMvcEngine is not found in nuget. which will register precompiled view in asp.net MVC application.

给我一个例子,如何办呢?

Give me an example how to do it?

推荐答案

基本上,你需要注册一个虚拟路径提供

Basically you need to register a virtual path provider


  1. 您必须注册在Global.asax的Application_Start处理程序的VirtualPathProvider。

  2. 您使用像这样的特殊路径必须调用您的DLL的观点:
    返回查看(〜/ foldernameofdlllocation / nameofdll.dll / nameofview.cshtml);

  1. You must register a VirtualPathProvider in the Global.asax Application_Start handler.
  2. You must call the view in your DLL using the special path like so: return View("~/foldernameofdlllocation/nameofdll.dll/nameofview.cshtml");

要帮助追查DLL使用类似的反射器或Telerik的JustDecopile(免费)内视图的位置。

To help track down the location of your view within the dll use something like reflector or telerik's JustDecopile (Free).

本博客文章可能对您有用:

http://www.wynia.org /字preSS / 2008/12 / ASPNET-MVC-插件/

这个问题也可能是使用的:

<一个href=\"http://stackoverflow.com/questions/236972/using-virtualpathprovider-to-load-asp-net-mvc-views-from-dlls\">Using的VirtualPathProvider从DLL的

从博客中的 code样品:<​​/ STRONG>

Code Sample from blog post:

http://www.wynia.org/download/ aspnetmvc-插件-POC / POC.MVCPluginDemo.zip

这篇关于包括在ASP.NET MVC Web应用程序pre-次编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆