我对MVC比较陌生。我正在做一些项目,以便对MVC架构如何工作有一个基本的了解,但我有一些问题。我想我已经覆盖了大部分内容,但是缺少一些东西(我希望是很小的)。
下面是我的模型、我编写的控制器/数据访问和BusinessLogic类函数,以及在视图上显示的方法。
有没有人能帮我仔细检查一下,希望能找出我做错了什么或遗漏了什么?谢谢。
@edit:我还想补充说,我在我的控制器func,BL和DA函数中都有调试器,它们都没有被命中过……我相信这就是问题所在。也非常感谢谁美化了我的问题。
模型
public class TerminalCommandVM
{
public TerminalC
上一次我调试我们的应用程序时,谁是用mvc编写的
我在globals.ascx.cs中路由上设置了一个断点
当我的断点转到正确的路由时,我看到了这一点。页面显示在浏览器中,但我的断点检查所有其他路由,谁写在globals.ascx中。
之后,当我刷新浏览器时,路由是工作的,但断点不是调试的。
表示url路由在asp.net MVC中是如何工作的。
我说"When you request the server all url routing is loaded in the cache and if you request again then he load from cache.
如何使用MVC中的新属性路由创建捕获所有路由?
我试过这个:[Route("{pagenode}", Order = 999)]
但是当我有一个像[Route("contact"]这样的指定路线
我得到了"Multiple controller types were found that match the URL. This can happen if attribute routes on multiple controllers match the requested URL."错误。
我正在尝试使用区域来配置Mvc路由。
这是我尝试的最简单的版本。
演示控制器
using System;
using Microsoft.AspNetCore.Mvc;
namespace SampleApp.Controllers
{
[Area("Demo")]
public class DemoController: Controller
{
[HttpGet("hello")]
public string Hello() => "Hello Guest";
}
}
St
ASP MVC 5有一个新的路由,称为属性路由。在我看来,路由现在分散在每个控制器上,而不是基于约定的单一位置RouteConfig.cs,您可以在其中检查您的路由,这也在某种程度上作为您的站点路由的文档。
我的问题是,在可读性和可维护性方面,使用属性路由比基于约定的路由更好吗?是否有人可以建议如何设计路由以获得更好的可维护性和可靠性。
我正在使用ASP.Net MVC Core2.0,并且很难让路由为连字符友好的URL工作。我希望使用以下URL样式:
admin is the area:
/admin/invoice-categories/new - Creates a new invoice category
/admin/invoice-categories/edit/1 - Edits a invoice category
/admin/invoice-categories - Shows the invoice categories list
这是我的控制器代码:
[Are