Using Web Service for Data Access methods XYZ_FETCH().

Using Web Service for Data Access methods XYZ_FETCH().

Old forum URL: forums.lhotka.net/forums/t/9400.aspx


tarekahf posted on Wednesday, August 18, 2010

I have developed applications (name Staff On-Line Services) using CSLA .NET 2.x which provides the logged in staff with their profile information (Education, Expereince, Salary...etc) from the back end legacy systems. The Back-End System is based in Adabas/Unix. The application is running live for almost one year. Since not all data is in Adabas, the Developed Business Objects read from Adabas as well as from SQL Server and MS Access as required.

Currently the Business Objects, in the XYZ_FETCH() part, are simply openning OLEDB connection to to Adabas (and/or MS Access + SQL Server) and using Command and SafeDataReader Object to fetch the required fields and fill the BO Properties.

Since we are migrating our core business modules from Adabas/Unix to SAP, the Development Team from Germany is developing custom Web Services to provide the required Details for Each Business Object. Note that there will be no changes to the current Business Object Desing.

We have a total of 20+ Business Objects which need to be modified to read the required Object Properties from the Web Services instead.

Since the migration process will be done gradually, so not all objects will have to be modified in one go, and since there will be parallel run period, so the Business Object must support reading the data using the old way (from Adabas/SQL/MS Access) and also support reading the Data from the new Web Services (SAP).

I hope I was able to explaing the requirements for change to the Business Objects developed using CSLA .NET method.

The Questions:
============

1. The Data Access Region, the method XYZ_FETCH() which is currently reading the data using OLEDB connection to Adabas using simple Commad and SafeDataReader objects. What is the best way to implement the change to read from the Web Service ? Just simple call the Web Service inside XYZ_FETCH() instead of openning a connection and SafeDataReader using a Command Object ?

2. What is the best method to implement support for reading the Data from Dual sources (OLEDB vs. Web Service) ? What is your recommendation ? I am thinking to allow the user to choose the source of the Data as soon as he logs in.

3. I was thinking I can do Configuration Changes in Web.Config to change the source of the Data for XYZ_FETCH(), since that was one of the good reason why we are have to use CSLA approach (Logical Architecture), but I could not figure out how to do that, any help on this issue ? I mean, it was mentioned that using CSLA you will be able to Focus on Business Requirements, ie, write your code regardless of the Physical Architecture, but I cannot figure out how to implement this feature with regards to my requirements.

3. I can migrate to CLSA 3.x, will this add any value to the implemented solution ?

Appeciate your feedback.

Tarek.

RockfordLhotka replied on Wednesday, August 18, 2010

There are four data access models supported by CSLA: http://www.lhotka.net/cslanet/faq/DataFaq.ashx

These are discussed in Chapter 18, and in even more detail in the Core 3.8 video series where there's an entire video on the topic along with samples.

Options 2-4 provide the indirection required to switch between DAL implementations via configuration.

Copyright (c) Marimer LLC