Up to this point I have discussed creating ECTs and BDC Models and Resources in SPD, VS, notepad, and Central Admin. So which should we be really using? I will first discuss each of these platforms:
is free tool from Microsoft that can provide no-code solution to creating BDC Models and ECTs. It will provide for rapid development without writing any code or markup, but has two major drawbacks. First, the solution will not be searchable as stated in Issue 3. Second, the solution will be specific to a SharePoint site that you are required to identify before developing your solution and you will not be able to deploy your solution to a different site.
If neither of the drawbacks is an issue for you, then SPD is a wonderful tool for your BCS development. It will even allow you to create External Lists (among other things) based on your ECTs with a push of a button.
Visual Studio (2010)
Another tool from Microsoft that will allow you to create BDC Models, Resources, and ECTs with code or XML markup. Although it is not free, no SharePoint developer should develop without it. It has no limitations on your BCS solution and will allow you to package and deploy your BCS Solution to multiple sites. It’s only true drawback is that you will either need to write code or XML markup for your solution and can therefore not really be recognized as a rapid development platform.
Notepad (or your favorite text editor)
Since you can develop BCS Solutions using only XML markup, there is nothing stopping you from writing your XML in your favorite text editor. This however is no small feat as you will need to be very familiar with all the necessary BCS tags and all their necessary attributes. In addition, this approach is very error prone.
Although Central Admin is not a development platform; it will however allow you to do certain things that will make your development easier. Central Admin will allow you to import and export both .bdcm and .bdcr files. This means that if you do develop your solution in either Notepad or SPD (or even VS for that matter), Central Admin will allow you to import those files, strip out or add resources, and then allow you to export the new model or resources. This is incredibly useful if you want to take a solution built in SPD for example which is targeted to a specific site, strip out all site specific information, and then export out a true BDC Model that can then be implemented on any SharePoint site.
There are also third-party platforms that provide much of the capabilities of SPD without some of the limitations in creating and implementing BCS Solutions that are worth investigating.
So which of the above would you think is the best way to go?
Well, the answer turns out to be a combination of the platforms above, taking advantage of each of the above platform’s capabilities and using another platform to overcome the drawbacks of the first. Below is the process I used to rapidly develop a solution that is both searchable and deployable to multiple environments:
- Create all the required ECTs for a given BDC Model in SPD
- Include at least a Finder and a Specific Finder method for each ECT
- Include any other necessary operations for each ECT
- Define any associations for each ECT
- Identify a field to mark as a Title field for each ECT
- Select all the ECTs and export them out as a single BDC Model
- Save that model as a .bdcm file on your local system
- Import the .bdcm file into (the BCS Service Application on) CA
- Export the model out of CA as a different .bdcm file then was imported into it
- Make sure to uncheck any resource checkboxes prior to exporting as a BDC Model (this strips out any resources out of your BDC Model)
- Open VS and create a new (or open an existing) Blank SharePoint 2010 project
- Add a new BDC Model item
- Delete the generated Entity1.cs and the Entity1Service.cs files
- Open the .bdcm file (using an XML editor within VS)
- Right-Click the .bdcm file and choose Open With…
- Delete all content in the .bdcm file in VS
- Open the .bdcm file exported from CA with Notepad (or your favorite simple text editor)
- Copy all content and paste it into the .bdcm file in VS
- Make all the necessary changes to make the model searchable (see Issue 3)
- If deploying from VS, then open the newly created Feature.Template.xml file and add the following markup:
<Property Key=’SiteUrl’ Value=’http://YourDevSite‘/>
- Note that for each BDC Model, there is a SharePoint feature (you cannot have more than one model per feature)
- The feature will be scoped to the Farm level (as all BCS Solutions are defined at the Farm level in CA)
- You should only deploy from VS for development purposes, for Integration, QA, or production deployments, you should use PowerShell
- Right-Click on your project and choose to package your solution
- Go to your Bin folder in your project from your file system and copy the WSP file that is generated when you performed step 15
- Save the WSP onto the SP Application Server that you want your solution deployed to
- Deploy and Activate your WSP package to the target SP Application Server
- Go to the BCS Service Application in CA and select the BDC Model that was just deployed
- 20. Right-Click the model and choose to Set Permissions
- Add all the accounts that will need the appropriate permissions to your BDC model and click OK
And you are done…Only 21 steps, not a lot ;).