score:44

Accepted answer

you will need to add reference to system.data.linq

system.data.linq is linq-sql specific (datacontext, etc)

using system;
using system.collections.generic;
using system.data.entity;
using system.data.linq;
using system.linq;

public static class queryclass
{
    public static void query()
    {
        using (var context = new mydbentities())
        {

            iqueryable<mytable> qtable= from t in context.tables
                                        select t; // can you confirm if your context has tables or mytables?
            console.writeline("table names:");
            foreach (var t in qtable)
            {
                console.writeline(t.name);//put the relevant property instead of name
            }
        }
     }
}

Related Query

More Query from same tag