tags:

views:

920

answers:

3

Hi i have got 2 table.In first table i got a Foreign Key link to second table's primary key.

(second)Personel and (first)Istbl are my tables.

In personel table i got PersonelID , PersonelName,PersonelSurname.

In Istbl table i got IsID,PersonelID,xx,xx,xx, going like this.

I cant see PersonelID in EF Model Viewer also i cant see it in code screen.

is there any example for me ?

A: 

Are you refreshing your datamodel? Have you created the model from the database, if so, try recreating it, if you have updated your database model.

REA_ANDREW
i can see it from second table Personel if i create new Personel Class but i cant see it in Istbl Class.I wanna give it a value while inserting data but intellisense is showing me Personel class not PersonelID property.So i cant add a value for it and my application giving me error
Ozlem Balli
+2  A: 

EF v1 hides foreign keys because it views them as persistence artifacts not important to the domain model. See here for a discussion.

EF v2, shipping with .NET 4, will include much better support for foreign keys in the model.

Andrew Peters
A: 

You can get foreign key value with something like this object foreignKey = istblObject.PersonelReference.EntityKey.EntityKeyValues[0].Value;

Branko Radicevic

related questions