Wednesday, January 9, 2013

To copy already created BDC model to new model follow these steps:

1) Add new BDC model with a new name
2) Copy and paste entity_name.cs file from old BDC model folder to new BDC model folder and change namespace to the new model namespace
3) Keep existing entity in the new model as it is and add a new entity
4) Rename new entity and add only primary key identifier to it
6) Add a ReadItem method to new entity using BDCMethod details window (Create specific finder method)
7) Change type descriptor of ReadItem return parameter to new custom entity class created in step 4, the method should be accepting primary key identifier created in step 4 as its only parameter.
8) Add ReadList method in similar way, this automatically recognises and uses new_entity_class as its return parameter.
9) Deploy solution and provide all permissions to the BDC model in SharePoint Central Administration
4) Open old_BDCModel.bdcm file using text editor and copy all identifiers and type descriptors list
5) Open new_BDCModel.bdcm file using text editor and replace its identifiers and type descriptors list with the one copied in above step
10) Try to create a new external list and verify that this content type is displyed in the available external content types list, this should throw "Method Not Implemented" error
11) Edit new_entity_nameservice.cs file and add functionality to ReadItem and ReadList methods.
12) Deploy and test

Important: Identifiers work similar to primary key for the entity while type descriptors work similar to properties

Update 26-Mar-2013: I learned it the hard way that

1) Identifier property must be specified for primary key type descriptor, else an external list can not be created with the enitity
2) Class returned by ReadItem and ReadList methods must have exactly same number and type of parameters as the type descriptors of method
3) All fields (type descriptors) must be recreated, they can not be copy pasted.

No comments:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...