2012-04-13 15 views
9

में मौजूद नहीं है मेरे पास एक .cs फ़ाइल में नीचे दिया गया कोड है और मैं नीचे दी गई त्रुटियों में आ रहा हूं, किसी भी मदद की सराहना की जाएगी।नाम या नामस्थान नाम नामस्थान

using System.Data.Entity; 

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

त्रुटियाँ:

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

** क्या आप एक असेंबली संदर्भ खो रहे हैं? ** – asawyer

+2

संदर्भ जोड़ने का प्रयास करें। समाधान फ़ाइल पर राइट क्लिक करें, संदर्भ जोड़ें पर क्लिक करें, फिर उचित डीएल देखें। – Sandeep

+1

एक संदर्भ जोड़ना 'कुछ नामस्थान का उपयोग करके लिखने के लिए बिल्कुल अलग है;' –

उत्तर

15

सुनिश्चित करें कि आपके परियोजना EntityFramework.dll का संदर्भ होता है सुनिश्चित करें।
विषय देखें यदि आप कोई संदर्भ जोड़ने के बारे में नहीं जानते हैं तो this link में दृश्य C# में कोई संदर्भ जोड़ने के लिए।

+0

हाय, धन्यवाद, मैंने संदर्भ सिस्टम जोड़ा। डेटा.इन्टिटी और इस त्रुटि को हल किया गया है, हालांकि मुझे अभी भी अन्य 3 पर त्रुटियां हैं, मदद की सराहना की जाएगी । – user1300580

+0

@ user1300580: कोई संदर्भ नहीं है "System.Data.Entity", यह बस अस्तित्व में नहीं है। उस नाम के साथ * नामस्थान * है। * संदर्भ * EntityFramework.dll नामक एक डीएलएल है। तो तुमने वास्तव में क्या किया? –

+0

मैं संदर्भ को खोजने में असमर्थ हूं EntityFramework यह संदर्भ है कि इस संदर्भ का xact नाम? – user1300580

1

ऑब्जेक्ट ब्राउज़र में अपने अनुपलब्ध संदर्भों को देखने का प्रयास करें।

संबंधित मुद्दे