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 IDataServicesM开发者_如何转开发etadataProvider?
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...
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.
精彩评论