How to custom linq primary key

Jan 5, 2009 at 1:46 AM
your primary key of linq class is Id.
But, I have a bulk of Tables whose primary key is others(many table,primary key are not same name). I still wanna use linq to manipulate. How to define the class? I don't want to use "Id".

question 2, can I define many primary key in one table? SQLserver can define many primary key in one table

thank you
Jan 5, 2009 at 4:29 AM
1: You can not define other PK/Name in the class who inherits from LinqDbObjectModel.
But the other way to use linq style query still working for who implemented IDBObject directly:

public class MyTable : IDbObject
    [DbKey(IsDbGenerate = false), Length(50)]
    public string Name { get; set; }
    public int Age { get; set; }
DbEntry.From<MyTable>().Where(p => p.Name == "tom").Select();

2: Sample ORM07 shows how to define and use multiple PK class.