ASP.Net 4 & MVC 3 Framework ile bir web uygulaması geliştiriyoruz. T4MVC'yi NuGet üzerinden kurdum ve tüm Görünümler, Denetleyiciler ve statik içerikler güçlü türler olarak başarıyla oluşturuluyor.Bir MVC 3 projesinde T4MVC tarafından oluşturulan kod ile hata derleme
Ama proje derlemeye çalıştığınızda, öyle oluşturulan dosya T4MVC.cs bir hata, yükseltir:
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class T4MVC_ViewResultBase : System.Web.Mvc.ViewResultBase,
IT4MVCActionResult
{
public T4MVC_ViewResultBase(string area, string controller, string action):
base() {
this.InitMVCT4Result(area, controller, action);
}
protected override void FindView(System.Web.Mvc.ControllerContext context){}
public string Controller { get; set; }
public string Action { get; set; }
public RouteValueDictionary RouteValueDictionary { get; set; }
}
:
'T4MVC_ViewResultBase.FindView(System.Web.Mvc.ControllerContext)':
return type must be 'System.Web.Mvc.ViewEngineResult' to match overridden member
'System.Web.Mvc.ViewResultBase.FindView(System.Web.Mvc.ControllerContext)'
Bu oluşturulan kaynak kodu
protected override void FindView(System.Web.Mvc.ControllerContext context) { }
olmalıdır: error diyor
protected override ViewEngineResult
FindView(System.Web.Mvc.ControllerContext context) { }
Ancak bu yöntem kod döndürmesi gerektiğinden başka bir derleme hatası oluşturur.
public abstract class ViewResultBase : ActionResult
{
...
protected abstract ViewEngineResult FindView(ControllerContext context);
}
kimse bu var Has: Biz System.Web.Mvc.ViewResultBase gelen devralır temel sınıf işaretlerseniz
, aslında ViewEngineResult dönüş türüyle FindView() beyan hata? MVC versiyonu ile bir ilgisi var mı, MVC 3 kullanıyor muyuz?
Çok teşekkürler! Sergi
hmm. Bu zor. Hayır, sürüm ile hiçbir şey, t4mvc benim mvc3 uygulaması için iyi çalışıyor. Umut David Ebbo buna cevap verecek =) – gideon