I created a console app, added the new item "LINQ to SQL classes", and dragged the single table Northwind\Customer from Server Explorer to the design pane. (The dbml file is shown below). I'm trying to use the code below to iterate over the Customer table but am lost. In the "var CustQuery" statement VS complains that it "Could not find an implementation of the Query pattern for the source type ConsoleApplication1. Customer." What? Any help much appreciated.
edm2
using System;
using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { DataClasses1DataContext db = new DataClasses1DataContext(); var CustQuery = from cust in Customer select cust; foreach (Customer cust in CustQuery) { Console.WriteLine("{0}", cust.City); } } } }
DBML: