Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

type or namespace name does not exist in the namespace

Tags:

c#

I have the code below in a .cs file and I am coming across the errors below, any help would be appreciated.

using System.Data.Entity;

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

Errors:

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?)
like image 641
user1300580 Avatar asked Apr 13 '12 12:04

user1300580


People also ask

How do I fix cs0234 error?

To fix this error, simply update the example . csproj file to use a previous System. CommandLine version. Note that this package is only used to parse the options for the example.

What is a namespace error?

The error means the namespace is not found in the partition map (keyed by the specified namespace).


1 Answers

Make sure your project contains a reference to EntityFramework.dll.
See the topic To add a reference in Visual C# in this link if you don't know how to add a reference.

like image 167
Daniel Hilgarth Avatar answered Sep 19 '22 15:09

Daniel Hilgarth