po wielkiej pomocy wczoraj natrafiłem na znany błąd w wersji beta asp.net4 - zaktualizowałem do VS2012 RC Express (4.5), a teraz VS zgłasza dwa błędy w moim modelu , które były ok poprzednio:ForeignKey nie jest rozpoznawany w VS2012 RC
„typu lub obszaru nazwa«ForeignKeyAttribute»nie można odnaleźć (czy brakuje using dyrektywa lub odwołania do zestawu?)”
„typu lub obszaru nazwa«ForeignKey» nie można znaleźć (czy brakuje instrukcji użycia lub odniesienia do zespołu?) "
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity;
namespace MvcApplication6.Models
{
public class tblRental
{
[Key()]
public int rental_id { get; set; }
public int room_id { get; set; }
public DateTime check_in { get; set; }
public DateTime check_out { get; set; }
public decimal room_cost { get; set; }
public long customer_ref { get; set; }
[ForeignKey("customer_ref")]
public virtual tblCustomerBooking Customer { get; set; }
}
public class tblCustomerBooking
{
[Key()]
public long customer_id { get; set; }
public string customer_name { get; set; }
public string customer_email { get; set; }
public virtual ICollection<tblRental> Rentals { get; set; }
}
Czy ktoś wie, czy odwołanie ForeignKey zostało zmienione?
Dzięki za wszelką pomoc,
Mark
przy okazji można użyć Ctrl +. (Kropka) skrót do automatycznego rozwiązania tego błędu – Alexander
wpadł na ten sam temat tydzień temu ... w nowym wydaniu dużo się przeniosły – Ben
Uderzam w odwrotny problem: Uaktualniono do RC 2012 i zrobiłem powyższe, aby moje atrybuty działały. Musiałem następnie przejść na wersję .NET 4.0 (Azure nie obsługuje jeszcze platformy .NET 4.5), a teraz trafiam na te same błędy, które nie są znalezione w atrybutach ForeignKey i NotMapped, mimo że wydaje mi się, że odwołuję się do właściwej biblioteki DLL (System.ComponentModel. DataAnnotations). Denerwujący. – jeremy