How to develop and deploy the ECTs/BDC Models to multiple environments

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:

SharePoint Designer
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.

Central Admin
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:

  1. Create all the required ECTs for a given BDC Model in SPD
    1. Include at least a Finder and a Specific Finder method for each ECT
    2. Include any other necessary operations for each ECT
    3. Define any associations for each ECT
    4. Identify a field to mark as a Title field for each ECT
  2. Select all the ECTs and export them out as a single BDC Model
  3. Save that model as a .bdcm file on your local system
  4. Import the .bdcm file into (the BCS Service Application on) CA
  5. Export the model out of CA as a different .bdcm file then was imported into it
    1. Make sure to uncheck any resource checkboxes prior to exporting as a BDC Model (this strips out any resources out of your BDC Model)
  6. Open VS and create a new (or open an existing) Blank SharePoint 2010 project
  7. Add a new BDC Model item
  8. Delete the generated Entity1.cs and the Entity1Service.cs files
  9. Open the .bdcm file (using an XML editor within VS)
    1. Right-Click the .bdcm file and choose Open With…
  10. Delete all content in the .bdcm file in VS
  11. Open the .bdcm file exported from CA with Notepad (or your favorite simple text editor)
  12. Copy all content and paste it into the .bdcm file in VS
  13. Make all the necessary changes to make the model searchable (see Issue 3)
  14. If deploying from VS, then open the newly created Feature.Template.xml file and add the following markup:
    <?xmlversion=”1.0″encoding=”utf-8″ ?>
    <Feature xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;
    <Properties>
    <Property Key=’SiteUrl’ Value=’http://YourDevSite‘/>
    </Properties>
    </Feature>

    1. Note that for each BDC Model, there is a SharePoint feature (you cannot have more than one model per feature)
    2. The feature will be scoped to the Farm level (as all BCS Solutions are defined at the Farm level in CA)
    3. You should only deploy from VS for development purposes, for Integration, QA, or production deployments, you should use PowerShell
  15. Right-Click on your project and choose to package your solution
  16. 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
  17. Save the WSP onto the SP Application Server that you want your solution deployed to
  18. Deploy and Activate your WSP package to the target SP Application Server
  19. Go to the BCS Service Application in CA and select the BDC Model that was just deployed
  20. 20. Right-Click the model and choose to Set Permissions
  21. 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 ;).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s