Adding navigation property to a view RRS feed

  • Question

  • I have a model with some tables and views. I would like to add a navigation property to one view, but since I'm a beginner with EF I'm stuck.

    Let's say that I have one table InventoryItems - each row has a unique ID (PK)

    I have a view - Orders - which has one column - InventoryItemID - that references said table/PK.

    How would I go about creating a navigation property on Orders? I've right clicked in the editor and Add->Association, selecting the table (one) and view (many) and then I map the navigation property on the view, but I get all sorts of errors; for example:

    The property 'InventoryItemID' is not a key member of the EntityType. Only key members can be mapped as part of the EndProperty mapping.

    The last step - mapping the navigation property - is what confuses me. InventoryItemID is not a key so it's not listed when I select Orders. If I set it as a key and map it to ID on InventoryItems I get the above error.

    If someone could guide me step by step I would be very grateful.

    Tuesday, November 6, 2012 9:27 PM


All replies