Create an External List using Visual Studio List Instance feature
The following blog explained very well about creating a BCS Model using Visual Studio 2010.
http://www.fabiangwilliams.com/2009/12/03/creating-a-sharepoint-2010-external-content-type-with-crud-methods-using-linq-and-a-sql-lob-system/
Now I would like to explain how to create a external list from this model using Visual Studio 2010 List Instance feature. Unfortunately there is no out of the box option available to create external list instance. Hence let's see how to achieve this.
First create any List instance (for example take Custom List) then it will generate Elements.xml file with ListInstance tag. Here we have to do two things.
1. Change the Template Type to 600
2. Add the DataSource tag with few BDC related properties. Here all property values are specific to your application.
<DataSource>
<Property Name="LobSystemInstance" Value="BdcModel1" />
<Property Name="EntityNamespace" Value="SPSDCEmployees.BdcModel1" />
<Property Name="Entity" Value="Employee" />
<Property Name="SpecificFinder" Value="ReadItem" />
</DataSource>
Final output looks like below.
http://www.fabiangwilliams.com/2009/12/03/creating-a-sharepoint-2010-external-content-type-with-crud-methods-using-linq-and-a-sql-lob-system/
Now I would like to explain how to create a external list from this model using Visual Studio 2010 List Instance feature. Unfortunately there is no out of the box option available to create external list instance. Hence let's see how to achieve this.
First create any List instance (for example take Custom List) then it will generate Elements.xml file with ListInstance tag. Here we have to do two things.
1. Change the Template Type to 600
2. Add the DataSource tag with few BDC related properties. Here all property values are specific to your application.
<DataSource>
<Property Name="LobSystemInstance" Value="BdcModel1" />
<Property Name="EntityNamespace" Value="SPSDCEmployees.BdcModel1" />
<Property Name="Entity" Value="Employee" />
<Property Name="SpecificFinder" Value="ReadItem" />
</DataSource>
Final output looks like below.
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ListInstance Title="Employee Entity" OnQuickLaunch="TRUE" TemplateType="600" FeatureId="00bfea71-de22-43b2-a848-c05709900100" Url="Lists/EmployeeEntity" Description="External Employee List"> <DataSource> <Property Name="LobSystemInstance" Value="BdcModel1" /> <Property Name="EntityNamespace" Value="SPSDCEmployees.BdcModel1" /> <Property Name="Entity" Value="Employee" /> <Property Name="SpecificFinder" Value="ReadItem" /> </DataSource> </ListInstance> </Elements>
Comments
Post a Comment