惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - 田老师

休息,考完了MCSD 如何用命令行将我的Phonegap环境更新到最新版本? 【新年福利】《正则表达式30分钟入门》APP版本发布 Cowboxer不能输入中文的解决方案 SharePoint Designer 报错“ Value does not fall within the expected range” Hyper-v 虚拟机时间与主机同步 【转载】C# 读取Excel文件代码的几种片段收集 【最新】判断是否为移动号码的正则表达式 使用.net调用java的Web Services Visual Studio中“生成”与“重新生成”的区别(The difference between "build" and "rebuild") 招商银行网上银行对账失败,总提示Communication Failed SQL Server Management Studio Express 无法连接 SQL Compact Edition(或新建数据库文件)的问题 试用SQL SERVER 2008 R2 SQL Server 2005无法启动服务 在VirtualBox中安装QuickTestProfessional10 最新、可靠的用于验证手机号码和移动号码的正则表达式 - 田老师 - 博客园 如何在重构时,批量重命名程序集的命名空间 defer属性导致引用JQuery的页面报“浏览器无法打开网站xxx,操作被中止”错误 Visual Studio 2010试用手记
《ASP.NET MVC Music Store Tutorial》在Visual Studio 2008简体中文环境下的代码修订
田老师 · 2010-08-30 · via 博客园 - 田老师

MvcMusicStore是基于MVC2的最佳MVC入门教程,但它是基于Visual Studio 2010的,如果你使用简体中文的Visual Studio 2008来重现ASP.NET MVC Music Store Tutorial中的示例代码,那么你会无法看到想要的效果。因为这些代码会有以下问题:

  1. VS 2008不支持<%: %>这样的写法,需改成<%=%>的语法,否则会报语法错误。
  2. LINQ不支持Single方法,需改成First,会报异常“LINQ to Entities 不支持方法“Single”。请考虑改用方法“First”。”,具体的LINQ语法差别可见http://msdn.microsoft.com/en-us/library/bb738550.aspx
  3. EF生成的结构有区别,中文生成的edmx中引用属性均为单数,但实际的MusicStore示例代码中所含的属性有些是单数,有些是复数,如果不修改对应的属性是无法通过的。
  4. 记得修改后要重构EF代码的命名。

解决以上问题后,Music Store的示例代码在VS2008中一样可以运行。

LINQ不支持Single方法,需改成First

 

 EF生成的结构有区别,中文生成的edmx中引用属性均为单数,但实际的MusicStore示例代码中所含的属性有些是单数,有些是复数,如果不修改对应的属性是无法通过的。

示例代码的EDMX 

VS2008自动生成的EDMX,注意红圈内容,这些应该是复数的。

记得修改后要重构EF代码的命名。