'Add Foreign Key properties' for a One to Zero-to-one relationship RRS feed

  • Question

  • I have an entity model which defines a One to Zero-to-one association between two entities. i.e.

    A  [0..1]..[1]  B
    A has one reference to B. B can have a reference to A.

    In defining this association, I want to have the ID of 'B' within 'A'. e.g. a B_ID property. For some reason, the option to do so - 'Add foreign key properties to the 'A' entity' - is disabled. I don't know why this is, and I'm unable to figure out how to do it manually.

    If anyone could help, or give me a reason for this, I'd be grateful.

    Monday, January 21, 2013 9:58 PM


  • Hi Barguast,

    Welcome to the MSDN forum.

    The foreign key column will be created implicitly in database after you run the sql generated by Entity Framework, so you are not required to add it manually.

    Have a nice day.

    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Alexander Sun Wednesday, January 30, 2013 8:40 AM
    Wednesday, January 23, 2013 2:55 AM