I am creating a POCO object for ADO.NET DataServce (they are called WCF DataServices now) The compiler tells me that entities need to have an ID property.
OK, that’s fine but I don’t want to call mine ID, I want to call it ‘Code’. What attribute do I put on the property ‘Code’ to tell the service that it is the ‘primary key’?
I have been searching Google for an answer but today I can’t seem the guess the right sequence of words
You add an attribute on your POCO class that tells ADO Data Services which property is your Unique Key. Like an example below. You mark the property to use with: DataServiceKey(“Id”)]. In my case it was “Id”. But you should be able to change it to somethign else.
Key property with different name: