将 asp.net MVC 从 Beta 升级到 Release 1.0

发布于 2024-07-21 20:25:49 字数 903 浏览 3 评论 0原文

a) 目前我在 asp.mvc beta 上部署了一个应用程序...但几天前它拒绝工作并出现以下错误:

找不到方法:'System.String System.Web.Mvc.Html.LinkExtensions。 RouteLink(System.Web.Mvc.HtmlHelper,System.String,System.Web.Routing.RouteValueDictionary,System.Web.Routing.RouteValueDictionary)'。

版本信息:Microsoft .NET Framework版本:2.0.50727.3053; ASP.NET 版本:2.0.50727.3053

谷歌结果没有给我一些相关的东西:

(b)我的下一步是将应用程序升级到 asp.net mvc 1.0 ...但这里我有一个新问题: 如果在测试版中我有:

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Edit(FormCollection entityform)
    {
        var entity = repository.GetById(1);

        UpdateModel(entity, entityform);
        repository.Update(entity);

        return View("Index", entity);

    }

那么现在 UpdateModel(map, "/ 接受 IValueProvider 或 DefaultValueProvider /");

问题:

  1. 这里改变了什么? (我想 hostng 环境已经改变了一些)
  2. 我应该在这里调整什么以免破坏已经实现的功能?

a) At the moment I have a deployed app on live on asp.mvc beta ... but few days ago it refuses to work with following error:

Method not found: 'System.String System.Web.Mvc.Html.LinkExtensions.RouteLink(System.Web.Mvc.HtmlHelper, System.String, System.Web.Routing.RouteValueDictionary, System.Web.Routing.RouteValueDictionary)'.

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

googed results doesn't give me something relevant :(

b) my next step was to upgrade app to asp.net mvc 1.0 ... but here I have a new issue:
if in beta I had :

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Edit(FormCollection entityform)
    {
        var entity = repository.GetById(1);

        UpdateModel(entity, entityform);
        repository.Update(entity);

        return View("Index", entity);

    }

then now the UpdateModel(map, "/ accepts IValueProvider or DefaultValueProvider /");

Questions:

  1. what was changed here? (I suppose that the hostng environment has changed something)
  2. what I should adjust here not to break already implement functionality ?

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

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

发布评论

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

评论(2

梦途 2024-07-28 20:25:49
UpdateModel(entity, entityform.ToValueProvider());
UpdateModel(entity, entityform.ToValueProvider());
戒ㄋ 2024-07-28 20:25:49

a) 当我升级我的网络项目时,我注意到 web.configs 中包含的内容是不同的。 请注意,主项目目录和视图内有 2 个 web.config。 我建议创建一个新的 MVC 1.0 项目并将 web.configs 与您的 beta 版本进行比较。

b) 我只是使用 UpdateModel 传入实体,如果您已将 FormCollection 传入 ActionResult,这将相应地更新它。

public ActionResult Edit(FormCollection entityform)
{
    var entity = repository.GetById(1);
    UpdateModel(entity);

a) When I upgraded my web projects I noticed that what is contained in the web.configs are different. Notice there are 2 web.configs, both in the main project directory and inside the Views. I would suggest creating a new MVC 1.0 project and comparing the web.configs to your beta version.

b) I just use UpdateModel passing in the entity and this will update it accordingly if you have passed in the FormCollection to your ActionResult.

public ActionResult Edit(FormCollection entityform)
{
    var entity = repository.GetById(1);
    UpdateModel(entity);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文