问题标签 [nerddinner]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
172 浏览

asp.net-mvc-3 - 当前的 IHttpHandler 不是以下类型之一:System.Web.UI.Page、DotNetOpenAuth.IEmbeddedResourceRetrieval

我使用 nerddinner 示例在我的项目中使用 mvc3/razor 配置 openID 我在 LogonOpenId.cshtml 中收到此错误 在此处输入图像描述

这是我实际的 LogonOpenId.cshtml 在此处输入图像描述

我为 openid 下载了 Nerddinner 作为一个整体项目。我附上我的 web.config 文件供他们参考,以检查我是否遗漏了任何依赖项。

我也添加了 Services/EmbeddedResourceUrlService.cs 文件。我不知道我还缺少什么。请帮助

0 投票
2 回答
1819 浏览

c# - NerdDinner MVC4 版本 - 他们为什么删除存储库类?

我一直在查看 NerdDinner 教程。我正在阅读原始 PDF 教程(使用 LINQ to SQL 和 MVC2的原始 PDF 教程 ( http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf )。在该教程中,他们实现了数据上下文,然后实现了存储库类以与数据实体进行交互。

我看到该项目已更新为使用 MVC4 和实体框架(http://nerddinner.codeplex.com ),因此我浏览了该代码以查看他们实施了哪些更改。他们将项目更改为代码优先,每个数据实体都有单独的模型类。我很惊讶地看到他们完全摆脱了存储库。

我认为通过存储库模式抽象与数据库的通信通常是一种好习惯......我知道为了简洁起见,教程通常会做出糟糕的设计选择,但我想知道为什么已经实现存储库的教程做出了决定从这个版本中省略它们。

MVC4 或 EF 中是否存在使存储库过时/冗余的东西?

0 投票
1 回答
125 浏览

c# - NerdDinner ASP 教程 - Linq-to-Sql 不为 OneToMany 创建集合

我正在尝试遵循 Microsoft 的 ASP.NET Nerd Dinner 教程,但我遇到了 linq-to-sql 部分的问题。

我有两个数据库 Dinner 和 RSVP,主键和身份设置为DinnerIDand RsvpID。然后我FK_RSVP_Dinner用外键RSVP.DinnerID和pk创建了关系Dinner.DinnerID

在创建 LinqToSql 类并将两个表拖入时,它成功创建了 OneToMany 关系。

LinqToSql 类 但是,NerdDinner.designer.cs 文件不包含任何称为 RSVP 的集合,而仅包含一个变量 RSVP。

在此处输入图像描述

我究竟做错了什么?

0 投票
1 回答
436 浏览

c# - 更改模型后未显示 ModelState 错误

我正在关注 Professional ASP.NET MVC 1.0 上的 NerdDinner 示例(我正在使用 VisualStudio 2015 附带的 ASP.NET MVC 版本),到目前为止,我能够解决一些小问题,但这一个让我.

我有一个名为 Dinner 的模型,它被传递给一个名为 Create() 的操作的视图。Create对应的视图基本上是一个表单,它要求一些信息,当它提交时页面显示错误,如果有任何错误。错误通过 ModelState 对象传递给视图。

创建视图看起来像这样。

这一直很好,直到我创建了一个名为 DinnerFormViewModel 的新模型来将其他对象传递给 Create 视图。

我更新了 Create() 方法以确保将正确的模型传递给相应的视图。

还更新了视图。

页面正常运行(正确保存了有效的表单数据),但是当提交无效信息时,页面上不再显示错误。在视图文件中,我检查了存储在 ModelState 中的错误,它们都在那里。ModelState 和表单字段之间似乎存在脱节。我在想问题是我提供给 ModelState.AddModelError() 方法的属性名称,但我不确定。任何帮助表示赞赏。

0 投票
3 回答
154 浏览

c# - Error trying to use a foreach loop with a sql database

I am recreating the website NerdDinner using MVC, ASP.NET. I have created a database containing the dinners, their dates, and other related information. On my index View, I am attempting to use a foreach loop to list all the dinners to the screen. I keep getting the error:

"foreach statement cannot operate on variables of type 'Dinner' because 'Dinner' does not contain a public definition for 'GetEnumerator'"

#xA;

I am pretty new to this and am not sure how to correct this issue, or really even WHERE the issue is located.

Here is my GitHub repo for the project. Sorry if the question is ambiguous, I am just a little lost and not really sure how to proceed from here.