I use EntityFramework and in my edmx file I have two tables mapped:
Customers column: Id PK
and Orders columns: Id PK CustomerId FK
which are associated.
When I take Order object there IS Customer property but I can't see Custome开发者_如何学CrId property. I used to work with L2SQL and I expected to see CustomerId but EF somehow hides it.
the Add Association dialog in the EF edmx designer allows you to specify (via a checkbox) whether or not you want to have a "Foreign Key" (and/or a Navigation Property) created for the association. did you make sure it's checked?
Inside the Customer property, there should be a CustomerId property.
So try..
myOrderObject.Customer.CustomerId
How exactly is the id column in the order table named? Usually the EF-Designer should create a property for each column in the database table. Have a look at the "Mapping details" page (which you can open in the context menu of the EF designer) to see if (and to which property) the column is mapped.
加载中,请稍侯......
精彩评论