none
entity framework code first database migration errors RRS feed

  • General discussion

  • hi. doing the entity framework code, and got errors. and tried managing the package manager. but not sure what to add. so tried the get new. but when i put the System.Data.Entity, it does not come up as one of the options, doing the console program. so will paste the errors below and paste the contents of the page of the example. or just the url. can any one help me out. how to fix these errors. marvin.  Error    1    The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    6    19    CodeFirstNewDatabaseSample
    Error    2    The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    71    36    CodeFirstNewDatabaseSample
    Error    3    The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    73    16    CodeFirstNewDatabaseSample
    Error    4    The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    79    16    CodeFirstNewDatabaseSample
    and here's my code. sorry. it is the the tutorial or topic i need to create a new database or first code navigation. will paste the code below., why am i getting these errors and how to fix. marvin. Error    1    The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    6    19    CodeFirstNewDatabaseSample
    Error    2    The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    71    36    CodeFirstNewDatabaseSample
    Error    3    The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    73    16    CodeFirstNewDatabaseSample
    Error    4    The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    79    16    CodeFirstNewDatabaseSample


    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    Monday, May 5, 2014 10:36 AM

All replies

  • hi. here's the url. sorry. marvin.  http://msdn.microsoft.com/en-us/data/jj193542

    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    Monday, May 5, 2014 10:40 AM
  • hi. and sorry. a blind person using a screen reader. jaws for windows from htttp://www.freedomscientific.com. so sorry, i did not post my code for the console application, c #. sorry. will paste below. so if any one can help me out and to get it to build and compile. and how to and which package to add, or which command to add. a newbie at the command prompt. and also will put my other code, as well.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data.Entity;


    namespace CodeFirstNewDatabaseSample
    {
        class Program
        {
            static void Main(string[] args)
            {
            }
        }

        public class Blog
        {
            public int BlogId
            {
                get;
                set;
            }
            public string Name
            {
                get;
                set;
            }

            public virtual List<Post> Posts
            {
                get;
                set;
            }
        }

        public class Post
        {
            public int PostId
            {
                get;
                set;
            }

            public string Title
            {
                get;
                set;
            }

            public string Content
            {
                get;
                set;
            }

            public int BlogId
            {
                get;
                set;
            }

            public virtual Blog Blog
            {
                get;
                set;
            }
        }

        public class BloggingContext : DbContext
        {
            public DbSet<Blog> Blogs
            {
                get;
                set;
            }

            public DbSet<Post> Posts
            {
                get;
                set;
            }
        }
    }


    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    Monday, May 5, 2014 10:54 AM
  • hi. sorry. will paste the new code from the program.cs file. sorry. my screen reader seems to be playing up with firefox and visual studio 2013. sorry. marvin.  using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data.Entity;


    namespace CodeFirstNewDatabaseSample
    {
        class Program
        {
            static void Main(string[] args)
            {
            }
        }

        public class Blog
        {
            public int BlogId
            {
                get;
                set;
            }
            public string Name
            {
                get;
                set;
            }

            public virtual List<Post> Posts
            {
                get;
                set;
            }
        }

        public class Post
        {
            public int PostId
            {
                get;
                set;
            }

            public string Title
            {
                get;
                set;
            }

            public string Content
            {
                get;
                set;
            }

            public int BlogId
            {
                get;
                set;
            }

            public virtual Blog Blog
            {
                get;
                set;
            }
        }

        public class BloggingContext : DbContext
        {
            public DbSet<Blog> Blogs
            {
                get;
                set;
            }

            public DbSet<Post> Posts
            {
                get;
                set;
            }
        }
    }

           

    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    Monday, May 5, 2014 10:56 AM
  • hi. well still waiting for help on this one. how do i fix this. still got errors. didd delete the project, then start again and enter the code. but still getting errors. can any one help. will paste the project below. marvin.  Hi.

      Please be gentle with me.

      Did google.

      And try to find.

      About entity first code.

      And doing a tutorial and topic.

      But in the command line.

      The System.Data. does not have the entity.

      And also.

      What packages do I need to manager for visual studio 2013.

      And will provide the link to the tutorial.

      Plus my code I have typed.

      So.

      Can any one help me to try to track down and fix the errors.

      And which paakcages I need to manage.

      In the tutorial.

      Using internet explorer and firefox.

      Just says project:manage package.

      Maybe the nget package which I have.

      And thought had added.

      Or do I need to manually enter commands in the package manager.

      Tried to do this.

      And retyped the code and just deleted the project.

      Started again.

      Typed the code.

      But will also post the errors below.

      Can any one help.

      Thanks.

      Marvin.

      Ps: point me in the right direction.

      Did google. And did read about the first code entity code in a console application.

      But says it cannot use the System.Data.Entity.

      And yes, did have a look at the options.

      No Entity.

      So.

      Maybe for an earlier version of visual studio maybe.

      I am running 2013 ultimate.

      Thanks.

      Marvin.

       

      http://msdn.microsoft.com/en-us/data/jj193542

       

      and here's the errors.

       

      Error      1              The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)                C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs                6              19           CodeFirstNewDatabaseSample

      Error      2              The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)                C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs                91           36           CodeFirstNewDatabaseSample

      Error      3              The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)                C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs                93           16           CodeFirstNewDatabaseSample

      Error      4              The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)                C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs                99           16           CodeFirstNewDatabaseSample

      using System;

      using System.Collections.Generic;

      using System.Linq;

      using System.Text;

      using System.Threading.Tasks;

      using System.Data.Entity;

       

       

      namespace CodeFirstNewDatabaseSample

      {

          class Program

          {

              static void Main(string[] args)

              {

                          using (var db = new BloggingContext())

              {

                  // Create and save a new Blog

                  Console.Write("Enter a name for a new Blog: ");

                  var name = Console.ReadLine();

                  var blog = new Blog { Name = name };

                  db.Blogs.Add(blog);

                  db.SaveChanges();

                  // Display all Blogs from the database

                  var query = from b in db.Blogs

                              orderby b.Name

                              select b;

                  Console.WriteLine("All blogs in the database:");

                  foreach (var item in query)

                  {

                      Console.WriteLine(item.Name);

                  }

                  Console.WriteLine("Press any key to exit...");

                  Console.ReadKey();

              }

          }

      }

       

          public class Blog

          {

              public int BlogId

              {

                  get;

                  set;

              }

              public string Name

              {

                  get;

                  set;

              }

       

              public virtual List<Post> Posts

              {

                  get;

                  set;

              }

          }

       

          public class Post

          {

              public int PostId

              {

                  get;

                  set;

              }

       

              public string Title

              {

                  get;

                  set;

              }

       

              public string Content

              {

                  get;

                  set;

              }

       

              public int BlogId

              {

                  get;

                  set;

              }

       

              public virtual Blog Blog

              {

                  get;

                  set;

              }

          }

       

          public class BloggingContext : DbContext

          {

              public DbSet<Blog> Blogs

              {

                  get;

                  set;

              }

       

              public DbSet<Post> Posts

              {

                  get;

                  set;

              }

          }

      }


    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    Wednesday, May 7, 2014 6:03 AM
  • hi. so can any one help me with this. thanks. marvin.

    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    Wednesday, May 7, 2014 7:51 AM