The TypeDescriptors incompletely define where the Identifiers of Entity ‘X’ are to be read–BCS Error

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

BDC Explorer - Showing TypeDescriptors

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

Supercar External Content Type

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!

TypeDescriptor Properties Tool Window

So we have done this
TypeDescriptor Properties Updating Identifier

Let’s try and deploy again (I think I know what’s going to happen, do you?)

External Content Type Data in Business Data Web Part

So there we are, we have fixed the error!

<Phill />

Tired of getting BCS errors? Why not try… BCS Meta Man

BCS Meta Man provides the ease of use of a drag and drop interface with the power of Visual Studio. It can save you days in time by generating the code required by SharePoint 2010 to read and write back to your External Systems.