방금 VS2010 (rc)으로 업데이트 한 후 내 프로젝트를 업데이트하고 강제로 MVC2 (ta microsoft)로 변환했습니다.이 덕분에 첫 번째 앱이 손도 닿았습니다.MVC에서 MVC2 로의 오류
Error 2 'System.Web.Mvc.IValueProvider' does not contain a definition for
'Where' and no extension method 'Where' accepting a first argument of type
'System.Web.Mvc.IValueProvider' could be found (are you missing a using directive or an
assembly reference?) ~\Controllers\DiscountsController.cs 51 39 ODSe
VS2008에서 작동하는 것을 알고있는 것을 고려하면 - MVC1 나는 약간의 예외입니다. 누군가?
나는 현재using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using ODSe.Models;
using System.Text;
using System.Text.RegularExpressions;
using System.Net.Mail;
야해 4 원래 프로젝트는 3.5이었다 닷넷해야 (포함) 한
; 와 MVC2는 .NET 3.5 (RC 2는 기존의 ASP.NET 3.5 SP1 런타임 위에 새로운 모델 - 뷰 - 컨트롤러 (MVC) 프레임 워크를 제공하는 2 ASP.NET MVC.)
코드 약 51입니다 코드가 MVC 위해 작성된는
foreach (var x in this.ValueProvider.Where(k => k.Key.StartsWith("discount.")))
{
if (String.IsNullOrEmpty(x.Value.AttemptedValue))
{
ModelState.SetModelValue(x.Key, new ValueProviderResult(ValueProvider[x.Key].AttemptedValue, collection[x.Key], System.Globalization.CultureInfo.CurrentCulture));
Discount = true;
}
}
(1) VS2008 this.ValueProvider에 IDictionary ControllerBase.ValueProvider이. MVC (2) VS2010에서 그것을 사용에 대해 hissy 착용감을 발생 "어디이 외관상 잘 비록 .
foreach (var x in this.ValueProvider)
{
if (x.Key.StartsWith("discount."))
{
if (String.IsNullOrEmpty(x.Value.AttemptedValue))
{
ModelState.SetModelValue(x.Key, new ValueProviderResult(ValueProvider[x.Key].AttemptedValue, collection[x.Key], System.Globalization.CultureInfo.CurrentCulture));
Discount = true;
}
}
}
엉뚱한 코드 조각이 아니라면; 레거시 코드는 매우 재미 있습니다.
나는 귀하의 권리를 생각합니다. 나는 코드를 위로 던져 버렸다. –