Jeff
Jeff

Reputation: 36573

WCF Data Services Metadata Provider and DataServiceKey

If I'm unable to annotate my classes with the DataServicesKeyAttribute to make WCF Data Services recognize my property Id as a key (since it only recognizes ID or ClassNameID by default), is there any other option besides writing my own IDataServicesMetadataProvider?

It's pretty stupid on Microsoft's part, considering the default capitalization scheme for the PK when you create an entity in an EDMX model is Id, not ID....and FURTHER Microsoft's naming convention guidelines suggest using Id not ID in terms of capitalization. Very stupid...

Upvotes: 0

Views: 397

Answers (1)

Vitek Karas MSFT
Vitek Karas MSFT

Reputation: 13320

If you really can't add the DataServiceKeyAttribute, then yes, the only way is to implement your own provider. Note that if you have an EF provider underneath your WCF Data Service then the key properties will be taken from the EF itself, not from the attributes on the classes. So this probably means that you're trying to do something else than EF. If that's the case, please post more detailed description, maybe there is another way.

Upvotes: 1

Related Questions