In this article we will be seeing shows how to get all the External Content Types by using the Business Data Connectivity (BDC) service Runtime object model. Description The following code example shows how to get all the External Content Types by using the Business Data Connectivity (BDC) service Runtime object model on the server. I have one external content type in BDC metadata store ( Go to Central Administration => Application Management => Manage Service Applications => Business Data Connectivity Service Application).
Prerequisites
Example
namespace BDCService { class Program { static void Main(string[] args) { using (SPSite site = new SPSite("http://serverName:1111/hr/MP/")) { SPServiceContext serviceContext = SPServiceContext.GetContext(site); BdcService bdc = SPFarm.Local.Services.GetValue<BdcService>(); IMetadataCatalog metadataCatalog = bdc.GetDatabaseBackedMetadataCatalog(serviceContext); foreach (IEntity ect in metadataCatalog.GetEntities("*")) { Console.WriteLine("Name: {0}",ect.Name); Console.WriteLine("Namespace: {0}", ect.Namespace); Console.WriteLine("Version: {0}", ect.Version.ToString()); } Console.ReadLine(); } } } }
Right click on the solution, Click on Build.
Hit F5.
Output:
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: