Entity Framework: Setting a Foreign Key Property

前端 未结 6 1494
暗喜
暗喜 2020-12-02 21:17

We have a table that looks roughly like this:

CREATE TABLE Lockers 
{
  UserID int NOT NULL PRIMARY KEY (foreign key),
  LockerStyleID int (foreign key),
  N         


        
6条回答
  •  难免孤独
    2020-12-02 21:53

    another method if you don't mind 'polluting' you db schema is to add a computed column, e.g. if you had a foreign key field FK_Customer you could define a new computed column FK_Customer_Computed which has the expression FK_Customer. When you generate\update your edmx model the field will appear like a regular field that you can then reference from you entity object.

    Or wait for EF4 :)

提交回复
热议问题