I am using Visual Studio 2012 Pro and I created a ASP.NET Empty Web Application project. I added a Linq to SQL class called PALinq in my App_Code directory and I also added a class file (.cs) in the App_Code directory.
I set the Context Namespace and Entity Namespace of the DBML to "PADB". I then added the using directive Using PADB; to my class file.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PADB;
namespace PA.App_Code.Comm
{
public class MessageBuilder
{
public static string GetPlayerContext(string username, string password)
{
using (PALinqDataContext db = new PALinqDataContext())
{
Player player = db.Players.Where(p => p.Email == username).SingleOrDefault();
if (player != null)
{
}
}
}
}
}
I changed the Build action on the .cs file to "Compile" and now I get a The type or namespace name 'PADB' could not be found (are you missing a using directive or an assembly reference?).
This is targeting .NET 4.5, any ideas why it can't see the Linq namespace? I have done this same methodology on other ASP.NET websites before VS2012 and it always worked.