We are going to investigate the following Issue in this blog post
There is an error in the TypeDescriptors of Parameters on Method with Name ‘GetAllSupercars’ on Entity (External Content Type) with Name ‘Supercar’ in Namespace ‘LightningTools.TheTestBcsModel.BdcModel1’. The TypeDescriptors incompletely define where the Identifiers of Entity ‘Supercar’ are to be read. That Entity expects exactly ‘1’ Identifiers, but only ‘0’ TypeDescriptors were found from which to read them.
OK, lets have a look at this error then. We can see that we have an issue with our TypeDescriptors, if we have a look in the BDC Explorer we can see our TypeDescriptors under the GetAllSupercars method, so somewhere here is where our problem lies
The error also mentions that
That Entity expects exactly ‘1’ Identifiers, but only ‘0’ TypeDescriptors were found from which to read them
If we have a look at the External Content Type in Visual Studio we can see that we have an Identifier defined
The thing to remember is that when we have an Identifier defined each method needs to return that identifier if it’s returning data. If we look though at our TypeDescriptors we can see that we ARE returning CarId, so why is SharePoint complaining at us?
Well…. I’ll tell you why, it’s because SharePoint does not know that CarId is the Identifier, it might have the same name but that doesn’t matter, we need to tell SharePoint which of our TypeDescriptors is the Identifier. If SharePoint EXPECTS exactly 1 identifier then we will give it one identifier, this is done by the following.
Select the ‘CarId’ TypeDescriptor from the BDC Explorer, make sure the properties window is turned on (press F4 if it isn’t). Now lets have a look at those properties.
We can see there is a property for Identifier, and there is a drop down. If we click on the Drop Down we can choose that this ‘CarId’ TypeDescriptor is the expected ‘CarId’ Identifier!
Let’s try and deploy again (I think I know what’s going to happen, do you?)
So there we are, we have fixed the error!