none
Intellisense not showing up on Visual Studio 2012 when working with Entity Framework 5 RRS feed

  • Question

  • Hi All,

    I'm new to Visual Studio 2012 and Entity Framework. Was trying to write my very first EF application.

    The EF has been defined in a separate class library and it has been referenced in the main console application.

    Intellisense is working absolutely fine

    Problem is that when I'm trying LINQ to Entities the intellisense is not working on the Entity Object.

    Same problem occurs when I'm using a Lambda Expression. Please refer to the code below. 

    I did check the internet for solutions and have already included System.Data.Linq and System.Data.Entity

    Any sort of help would be much appreciated.

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

    namespace MyFirstEFCode
    {
        class Program
        {
            static void Main(string[] args)
            {
                AdventureWorksLT2008Entities awtl = new AdventureWorksLT2008Entities();
                List<Product> products = null;
                var prodQuery = from prod in awtl.Products
                                select prod.
            }
        }
    }

    Wednesday, May 7, 2014 2:19 PM

Answers

  • Hello Vipul,

    Since you are using a separate class library, you need to install the Entity Framework to your Console Application, too since when you add reference to the class library, the EntityFrameowk.dll will not be copied to the Console Application. And you need to also copy the connection string from .config file in class library to the app.confile in your Console Application project:

    <connectionStrings>
    
        <add name="DFDBEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(localdb)\Projects;initial catalog=DFDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    
      </connectionStrings>
    

    Or it will throw an error saying that it cannot find the database.

    If this does not work for you, please let me know.

    Regards.


    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.

    Thursday, May 8, 2014 2:48 AM
    Moderator

All replies

  • Moving this question to the Entity Framework forum.

    Esther Fan | Visual Studio | If a post answers your question, please mark it as the answer. Thanks!

    Wednesday, May 7, 2014 5:46 PM
  • Hello Vipul,

    Since you are using a separate class library, you need to install the Entity Framework to your Console Application, too since when you add reference to the class library, the EntityFrameowk.dll will not be copied to the Console Application. And you need to also copy the connection string from .config file in class library to the app.confile in your Console Application project:

    <connectionStrings>
    
        <add name="DFDBEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(localdb)\Projects;initial catalog=DFDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    
      </connectionStrings>
    

    Or it will throw an error saying that it cannot find the database.

    If this does not work for you, please let me know.

    Regards.


    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.

    Thursday, May 8, 2014 2:48 AM
    Moderator