how to insert using linq to entity foreign key value?

Posted by Gamble on Stack Overflow See other posts from Stack Overflow or by Gamble
Published on 2010-05-02T22:14:35Z Indexed on 2010/05/02 22:17 UTC
Read the original article Hit count: 403

Filed under:

I have a table (TestTable) for example:

ID
Name
Parentid (FK)

and I would like to insert a new record like ID(1) Name(Test) ParentID(5) FK. How can insert a new record into TestTable with linq to entity?

var testTable = new TestTable();
testTable.ID = 1;
testTable.Name = "TestName";
testTable ...

thank you for the working example.

© Stack Overflow or respective owner

Related posts about linq-to-entities