如何不为应用程序中的每个区域实例化 Cassini 实例?

发布于 2024-08-04 01:41:35 字数 105 浏览 5 评论 0原文

我一直在实现区域,但发现它在启动卡西尼时会为每个区域实例化一个开发服务器。

这真的有必要吗? MSDN 让我将这些区域设置为单独的 Web 应用程序,为什么我不能将它们放入类库中?

I've been implementing areas, but have found that it instantiates a development server for each area when it launches Cassini.

Is this really necessary? MSDN is having me setup these areas as separate web apps, Why can't I put them into class libraries?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一身软味 2024-08-11 01:41:35

是的,您可以将它们放入类库中。您可能想了解 MVCContrib 的人员在做什么。他们称其为便携式区域,为您提供所需的库。他们使用自己的嵌入式视图引擎从 dll 中获取视图。这是 链接 引导您完成整个过程。

Yes, you can get them down to class libraries. You may want to look into what the guys at MVCContrib are doing. They are calling it portable areas which gives you the libraries that you were asking for. They use their own Embedded view engine to get the views back out of the dll. Here is the link that walks you through the process.

猫卆 2024-08-11 01:41:35

经过大量研究后,答案似乎是“还没有”。我们仍处于 ASP.NET MVC v2 的预览版本中,因此我决定应该退一步,直到他们对此感到非常满意为止。

我想为那些对模块化 ASP.NET MVC 项目感兴趣的人记下我的经验。

目前,每当您进行构建时,它基本上都会将所有子项目(为这些区域创建)复制到父项目中。然而,一旦您对某个区域中的视图进行更改,该更改将在构建后起作用,直到您重建后才会显示该更改。这会损害敏捷性,我知道团队现在正在考虑这一问题。

由于这种“断开连接”的项目结构,您确实会在视图中遇到一些我们通常忽略的标记问题(丢失智能感知)(例如脚本引用等)。请记住,从长远来看,这只是一个应用程序。

另外,上面发布的问题。调试时您将拥有单独的开发实例,但它会部署为一个应用程序。

总体而言,可以选择“自行开发”您自己的模块化解决方案(就像 CWAB 所做的那样),但我建议您等待下一个“支持的”预览版。我对这支球队和他们的能力感觉非常好。完善的地方确实会让我们满意。

After much research the answer appears to be "not yet". We're still in a preview release of ASP.NET MVC v2 so I've decided I should back off until they feel really good about it.

I thought I'd jot down my experiences for those of you interested in modularizing your ASP.NET MVC projects.

Currently, whenever you do a build it basically copies all of your child projects (created for the areas) into the parent. Which works after a build HOWEVER, once you make a change to your views in an area, the change doesn't show up until you rebuild. This one hurts agility and I know the team is looking at it now.

Because of this "disconnected" project structure, you do get some flagged issues (lost intellisense) in the view which we just typically ignore (like script references etc). Just remember it's one application in the long run.

Also, the issue with that posted above. You will have seperate dev instances when debugging but it deploys as one application.

Overall, there are options to "home grow" your own modularized solution (much like CWAB did) but I'd urge you to wait for the next "supported" preview. I feel really good about this team and their abilities. Perfecting areas will really make us satisfied.

鸢与 2024-08-11 01:41:35

万一有人因为仍在使用多个项目构建区域而偶然发现这一点,您绝对可以在 MVC 2 中的单个项目中执行此操作。使用单项目方法,当您在本地启动时,您只会获得一个正在运行的实例。有一个 MSDN 教程,可以引导您完成单个项目区域,但要注意它们的

In case anyone stumbles on this because they are still building Areas using multiple projects, you can definitely do this within a single project in MVC 2. With the single-project method, you get only one running instance when you start it up locally. There is an MSDN tutorial that can walk you through single-project Areas, but watch out for their area registration bug when you start unit testing it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文