Monday, 15 March 2010

.net - I want to specify a primary key column in MVC view -



.net - I want to specify a primary key column in MVC view -

i have no problem generating .edmx file mvc project working on. involves 1 table , 1 view. however, ef decides on primary key, unique value each row, hoping create text field primary key because search on. has unique values.

error 6002: table/view 'dws.dbo.inventorytiny' not have primary key defined. key has been inferred , definition created read-only table/view. c:\dws\dws\dws.edmx

read-only ok. alter primary key different column. how do , humble idiot in advance.

ok, problem not in changing sql server table , views. can't because used other stuff.

but found solution simple , far restart, has worked. in designer window .edmx file, right clicked on column name, , unchecked "primary key" selection , went , right clicked on column wanted use. doh. if snake have bit me.

there is/was no code show. message ef generator decided pick primary key on view. didn't want primary key automatically picked.

here found answer: error 6002: table/view not have primary key defined

thank stack on flow

.net sql-server asp.net-mvc entity-framework entity-framework-4

No comments:

Post a Comment