Add appropriate error message if no primary key

Add an appropriate error message if there isn't a primary key. This is something we're doing in a small number of components (e.g. weblinks) but probably should do across the board