Wednesday, August 5, 2009

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

The last part described how to replace the Entity Framework with custom Data Sources. This part goes into more detail concerning the necessary modifications in the Host & Client projects.

At the end of this part you will have a fully working ADO.NET Data Service that is based on your own custom Data Structure and Data Sources.

  • Open the Client project and add a new Service Reference to the ExampleDataService2
ADO Data Services - Part 5 - 01ADO Data Services - Part 5 - 02

  • Change the implementation in the Main function and add a new proxy to the new ADO.NET Data Service

ADO Data Services - Part 5 - 03

  • Change the implementation in the Read function and add a two new function calls in dependency of the user input

ADO Data Services - Part 5 - 04

  • Add the implementation of the new ReadEF and ReadCustom functions so that the correct proxy is used to query for data and display it in the console

ADO Data Services - Part 5 - 05 ADO Data Services - Part 5 - 06

  • Open the Host project and modify the Main function so that both ADO.NET Data Services are hosted on different addresses

ADO Data Services - Part 5 - 07


Share/Save/Bookmark

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