2012-04-13 48 views
9

Ho il codice qui sotto in un file .cs e sto incrociando gli errori qui sotto, ogni aiuto sarebbe apprezzato.nome o spazio dei nomi non esiste nello spazio dei nomi

using System.Data.Entity; 

namespace Assignment2.Models 
{ 
    public class TicketBookingEntities : DbContext 
    { 
     public DbSet<Performance> Performances { get; set; } 
     public DbSet<Production> Productions { get; set; } 
    } 
} 

Errori:

Error 1 The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) 
Error 2 The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) 
Error 3 The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?) 
Error 4 The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?) 
+4

** manca un riferimento all'assembly? ** – asawyer

+2

Prova ad aggiungere il riferimento. Fare clic con il tasto destro del mouse sul file della soluzione, fare clic su aggiungi riferimento, quindi cercare la dll appropriata. – Sandeep

+1

l'aggiunta di un riferimento è totalmente diversa dalla scrittura di 'using Some.Namespace;' –

risposta

15

assicurarsi che il progetto contenga un riferimento a EntityFramework.dll.
Vedere l'argomento Per aggiungere un riferimento in Visual C# in this link se non si sa come aggiungere un riferimento.

+0

ciao, grazie, ho aggiunto il riferimento System.Data.Entity e questo ha risolto questo errore tuttavia ho ancora gli errori sugli altri 3, l'aiuto sarebbe apprezzato . – user1300580

+0

@ user1300580: non esiste alcun riferimento "System.Data.Entity", semplicemente non esiste. C'è uno * spazio dei nomi * con quel nome. Il * riferimento * è una DLL denominata EntityFramework.dll. Quindi cosa hai fatto veramente? –

+0

Non riesco a trovare il riferimento EntityFramework è che il nome xact di questo riferimento? – user1300580

1

Prova a cercare i riferimenti mancanti nel Visualizzatore oggetti.

Problemi correlati