tags:

views:

100

answers:

1

When I do this manually

public class AdventureWorks : DataContext
{
    public AdventureWorks(string connection) : base(connection) { }
    public Table<Contact> Contacts;
}

[Table(Name = "Person.Contact")]
public class Contact
{

    [Column(DbType = "int not null", IsPrimaryKey = true, IsDbGenerated = true)]
    public int ContactID;

    [Column(DbType = "nvarchar(8) not null")]
    public string Title;

    [Column(DbType = "nvarchar(50) not null")]
    public string FirstName;

    [Column(DbType = "nvarchar(50) not null")]
    public string MiddleName;

    [Column(DbType = "nvarchar(50) not null")]
    public string LastName;

    [Column(DbType = "nvarchar(50) not null")]
    public string EmailAddress;

    [Column(DbType = "int")]
    public int EmailPromotion;

    [Column(DbType = "bit")]
    public byte NameStyle;

    [Column(DbType = "varchar(40)")]
    public string PasswordHash;

    [Column(DbType = "varchar(40)")]
    public string PasswordSalt;

}

I can use something like this

AdventureWorks db = new AdventureWorks("Integrated Security=sspi");
Contact cont = db.Contacts.Single(c => c.ContactID == 1280);

But If I rely on LINQ surface (designer), drag and drop contact table on the dbml file , I can see db.Contacts, but can not see the "db.Contacts.Single" method.

Is there anything to do with dbml property configiuration?

Please advise.

Thanks a lot.

+4  A: 

Are you "using" these two namespaces?

using System.Data.Linq;
using System.Linq;
Dave Markle
You're the man. It's the problem. I fixed it. Thanks a lot
simon
Just accept and uprate my answer ;-)
Dave Markle