Tuesday, August 4, 2009

[Tutorial] ADO.NET Data Services
Part 4 – Custom Data Sources 1/2

The last part showed how to host an ADO.NET Data Services and how to create a proxy to consume it. This part describes how to replace the Entity Framework part with custom Data Sources (for example POCO business objects).

By doing this, you will get the full functionality of ADO.NET Data Services but the flexibility to use you own custom Data Sources (Object in Memory, Oracle DB, Data Cubes, Files, etc…).

  • Open the ADO.NET Data Service project and add some new classes that will serve as structure for your custom Data  Source  (for example  Invoice, InvoiceLine, Thirdparty and BusinessEntities)

ADO Data Services - Part 4 - 01 ADO Data Services - Part 4 - 02  ADO Data Services - Part 4 - 03

  • The BusinessEntities class serves as container for the different custom entities that you want to expose, they are initialized in the constructor for the example and must be accessible via public IQueryable properties

ADO Data Services - Part 4 - 04

ADO Data Services - Part 4 - 05ADO Data Services - Part 4 - 06 ADO Data Services - Part 4 - 07ADO Data Services - Part 4 - 08

  • Add a new item of type ADO.NET Data Service

ADO Data Services - Part 4 - 09

  • Change the Data Service code of the new ExampleDataService2 and add as type the custom BusinessEntities

ADO Data Services - Part 4 - 10


Share/Save/Bookmark

No comments: