No Key generated with CTP and Database First

166 views Asked by At

I am working with Entity Framework 4, CTP 5, and an existing database. I am using Database First (so I have an edmx model, and I am using the DbContext code generation template).

My database has primary keys defined (they are not identity, they are strings, and it's a legacy system, so I cannot change that).

When EF generates my entity objects, there are no Key attributes on them, and I get errors indicating that there is no key (I'm usign this with WCF RIA services -- or attempting to, anyway). I also looked in the DbContext, and there is no key mapping created there either.

I know I could go in and modify the T4 template, but I'm assuming that I must be doing something wrong -- the MS template surely isn't just ignoring PK's, is it?

0

There are 0 answers