none
Entity framework errors RRS feed

  • Question


  • I got redirected here

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data.Linq;
    using System.Data.Linq.Mapping;
    using Microsoft.Data.Edm;
    
    namespace Entity_Framework
    {
        // You'll need to reference System.Data.Entity.dll
        [EdmEntityType (NamespaceName = "NutshellModel", Name = "Customer")]
        public partial class Customer
        {
            [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
            public int ID { get; set; }
            [EdmScalarProperty(EntityKeyProperty = false, IsNullable = false)]
            public string Name { get; set; }
        }
        class Program
        {
            
            static void Main(string[] args)
            {
               
            }
        }
    }

    So far this is what i did

    1. Typed 'Install-Package Microsoft.Data.Edm'  in the package manager console. Then installed successfully

    2. Added 'using Microsoft.Data.Edm;' to the code

    The error still appears as follows:

    Error  1 The type or namespace name 'EdmEntityType' could not be found (are you missing a using directive or an assembly reference?)

    Error  2 The type or namespace name 'EdmEntityTypeAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Error  3 The type or namespace name 'EdmScalarPropertyAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Error  4 The type or namespace name 'EdmScalarPropertyAttributeAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Error  5 The type or namespace name 'EdmScalarProperty' could not be found (are you missing a using directive or an assembly reference?)

    Error  6 The type or namespace name 'EdmScalarPropertyAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Anyone know how to fix this? I am using visual studio 2012 express btw.
    • Edited by RegasSolqui Tuesday, September 10, 2013 5:57 PM
    Tuesday, September 10, 2013 5:56 PM

Answers

  • Hi RegasSolqui;

    Did you also install Entity Framework from the package manager console by typing the following command at the prompt?

    Install-Package EntityFramework

    In order to get access to the EdmEntityType you need to add the following using statement at the top of the code file:

    System.Data.Metadata.Edm


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, September 10, 2013 8:43 PM
  • It would be better to install the whole EF package: Install-Package EntityFramework -Version 5.0.0.

    Wednesday, September 11, 2013 1:07 AM

All replies

  • using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data.Entity;
    using System.Data.Entity.Design;
    using System.Data.Linq;
    using System.Data.Linq.Mapping;
    
    namespace Entity_Framework
    {
        // You'll need to reference System.Data.Entity.dll
        [EdmEntityType(NamespaceName = "NutshellModel", Name = "Customer")]
        public partial class Customer
        {
            [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
            public int ID { get; set; }
            [EdmScalarProperty(EntityKeyProperty = false, IsNullable = false)]
            public string Name { get; set; }
        }
        class Program
        {
            
            static void Main(string[] args)
            {
               
            }
        }
    }

    ERRORS

    Error 1 The type or namespace name 'EdmEntityType' could not be found (are you missing a using directive or an assembly reference?)

    Error 2 The type or namespace name 'EdmEntityTypeAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Error 3 The type or namespace name 'EdmScalarPropertyAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Error 4 The type or namespace name 'EdmScalarPropertyAttributeAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Error 5 The type or namespace name 'EdmScalarProperty' could not be found (are you missing a using directive or an assembly reference?)

    Error 6 The type or namespace name 'EdmScalarPropertyAttribute' could not be found (are you missing a using directive or an assembly reference?)

    I have tried adding references to System.Data.Entity.dll and System.Data.Entity.Design.dll on the project menu but nothing seems to happen. I am using Visual studio 2012 express edition.

    EDIT: I found out that this is from the Microsoft.Data.Edm assembly, but this is not found in my existing references





    • Edited by RegasSolqui Tuesday, September 10, 2013 3:47 PM
    • Moved by CoolDadTx Tuesday, September 10, 2013 7:58 PM EF related
    • Merged by Fred BaoModerator Wednesday, September 11, 2013 1:48 AM They are the same.
    Tuesday, September 10, 2013 3:26 PM
  • You will need to add a reference to Microsoft.Data.Edm.dll if you are adding the references manually. It would be easier to use nuget to install EF though,

    Tuesday, September 10, 2013 3:46 PM
  • The error still persist

    This is what i did

    1. Typed 'Install-Package Microsoft.Data.Edm'  in the package manager console. Then installed successfully

    2. Added 'using Microsoft.Data.Edm;' to the code

    same error occurs

    Tuesday, September 10, 2013 4:05 PM
  • There is a MSDN EF forum.
    Tuesday, September 10, 2013 4:47 PM
  • Hi RegasSolqui;

    Did you also install Entity Framework from the package manager console by typing the following command at the prompt?

    Install-Package EntityFramework

    In order to get access to the EdmEntityType you need to add the following using statement at the top of the code file:

    System.Data.Metadata.Edm


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, September 10, 2013 8:43 PM
  • So far i have added

    EntityFramework and EdmLib installed to my package

    and added these to the code

    using System.Data.Metadata.Edm;
    using Microsoft.Data.Edm;

    using System.Data.Entity;

    But error list tab still won't disappear, same as before.

    Wednesday, September 11, 2013 1:04 AM
  • It would be better to install the whole EF package: Install-Package EntityFramework -Version 5.0.0.

    Wednesday, September 11, 2013 1:07 AM
  • Hi RegasSolqui;

    Can you create a small test project exhibiting the same conditions that I may look at or if you can your current project if it is not to large. Please if you do so zip the project up and maybe use you Skydrive to upload to and post the link here. 

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, September 11, 2013 1:02 PM