locked
Unique index as Principal Key RRS feed

  • Question

  • Hi,

    create table [mytab1]
    (
     [colA] varchar(30) not null,
     [colB] varchar(14) not null,

     constraint [mytab1_pk] primary key
      ([colA],[colB])
    )

    create unique index [mytab1CandidateKey] on
    [mytab1]([colB])

     

    create table [mytab2]
    (
     [colB] varchar(14) not null,
     [colC] varchar(10) not null,

     constraint [mytab2_pk] primary key
      ([colB],[colC])
    )

     

    In EF "ADO.NET Entity Data Model" I would like to make an association mytab1mytab2  (1:n) using the candidate key mytab1.colB as the Principal Key.
    This seems to be possible in "Link to SQL Classes".
    Has the possibility to use a non primary key  but candidate key (uniquely indexed) as the Principal Key, deliberately been left out in EF?

    Regards Roger.

    Thursday, September 29, 2011 2:13 PM

Answers

All replies