External content types are defined as reusable objects with metadata descriptions of connectivity information to external systems and data definitions. They could also contain the behaviors you want to apply to the external data. They are similar to the content types that we have dealt so far. The difference is that we will be managing the external data in external content types. The external data can be from relational databases like SQL server or Oracle or data coming from some web service.
For our recipe, we will use a SQL server table and create a content type based on the table data. We will use the
HumanResources.Department table in the
AdventureWorks database. We will create a
GetDepartments method that will retrieve the list of all departments and a
GetDepartment method that retrieves the single department object.
We will use LINQ to SQL to access relational data as objects. You do not have to use LINQ to SQL for data access in external content types...