none
enttity framework issues RRS feed

  • General discussion

  • 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:12 AM

All replies

  • Marvin,

    You are in the wrong forum, your problem is handled in the next room. 

    http://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetentityframework


    Success
    Cor

    Wednesday, May 7, 2014 7:46 AM
  • Hi,

    The System.Data.Entity is under EntityFramework.dll, you can use the PMC to install it as:

    Install-Package EntityFramework


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, May 7, 2014 9:09 AM
    Moderator
  •   Please be gentle with me.

      Did google.

      And try to find.

      About entity first code.
       And doing a tutorial and topic.

    I suggest that you do a simple Database first Windows form tutorial. It will have more meaning to you than some console application.  

    http://www.vbforums.com/showthread.php?540421-Tutorial-An-Introduction-to-the-ADO-NET-Entity-Framework

    The C# version is at the top of the link, but it lacks the form screen shots you need to use and the VB version has them.

    http://henry416.wordpress.com/2013/11/17/entity-framework-6-and-visual-studio-2013/

    Wednesday, May 7, 2014 9:29 AM
  • hi. thanks for your help. saved that and put that in my favorites. will take a look. why is the data.entity not in the console for c#. did they get that tutorial wrong. marvin. ps: once i have done that. have deleted the entity framework console. will try that after doing the intro. also. how do i fix the issue with my application MvcMovie. when i run, cannot find the browser, but if i right click and view in browser. it goes to that. so maybe i could have your private e-mail. send it to me off forum. and then can upload the project to send space for you to have a look. and send you the link to the getting started tutorial. thanks. marvin.ps: sorry for being a pain and bugging you guys. thanks for your help and support.

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

    Thursday, May 8, 2014 2:37 AM
  • hi. that fixed it. installed the entity framework and now have a packages .config. thanks. and the entity option is in the data package. thanks. marvin.ps: sorry for bothering you. it did not read that out in the tutorial. just a graphic. sorry. marvin.

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

    Thursday, May 8, 2014 6:32 AM
  • hi. well installed the entity package. but now got the following errors. how do i fix this. what code do i need will paste the errors below and the package.config file. so i can get this to work. thanks. marvin.  Warning    1    The 'packages' element is not declared.    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\packages.config    2    2    CodeFirstNewDatabaseSample
    Error    2    The type or namespace name 'BloggingContext' could not be found (are you missing a using directive or an assembly reference?)    C:\Docs\Programming\AspDotNet\CodeFirstNewDatabaseSample\CodeFirstNewDatabaseSample\Program.cs    15    33    CodeFirstNewDatabaseSample
    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="EntityFramework" version="6.1.0" targetFramework="net45" />
    </packages>

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

    Thursday, May 8, 2014 7:06 AM
  • I'll suggest again for now for you to abandon the Code first tutorial using a console application and go with the simple Windows Desktop Database first tutorial, that's if you want lift-off and headed for the big EF in the sky.
    Thursday, May 8, 2014 7:37 AM
  • hi. well. will just delete and go with the simple database application. once done. then come back to the console application. okay. will take your advice. then. what happens if i run into errors. and search for the entity package online. thanbks. marvin.

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

    Thursday, May 8, 2014 7:51 AM
  • hi. well. will just delete and go with the simple database application. once done. then come back to the console application. okay. will take your advice. then. what happens if i run into errors. and search for the entity package online. thanbks. marvin.

    If you can't get the simple Windows desktop Database solution to run, then post back. :)

    Thursday, May 8, 2014 9:04 AM