This seems obvious but I cannot see an easy way to to do this.
I have written a C# Program in LinqPad and it runs well, is there a guide for moving this to a Visual Studio Console Program.
A simple program such as this:
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)
{
DataContext dataContext = this;
var products = dataContext.GetTable<Product>();
var query = from p in products
select p;
query.Dump();
}
}
}
produces these errors:
Error 1 The type or namespace name 'DataContext' could not be found (are you missing a using directive or an assembly reference?) c:\users\xxx\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs
Error 2 Keyword 'this' is not valid in a static property, static method, or static field initializer c:\users\xxx\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs
Error 3 The type or namespace name 'Product' could not be found (are you missing a using directive or an assembly reference?) c:\users\xxx\documents\visual studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 14 49 ConsoleApplication1
I must have to add some references, add a connection to the database, I just need a guide for what to add to my project but I cannot find one.