0

I have an existing 3 tiers application (DAL-BL-UI) which installed on one web server. the web server communicates directly to the Database server (MSSQL) using Framework 4 ADO.NET. What is the fastest way to change the existing application to not communicate directly to the Database server. I want to add a "middle server" between the Web and the Database server with minimum of code change.

Any ideas?

Omtechguy
  • 3,321
  • 7
  • 37
  • 71
  • Are you able to place the DAL into its own separate assembly ? – Symeon Breen Jan 29 '13 at 14:55
  • i hope that there is an option that my application will communicate with a kind of "Virtual Service" such the old ODBC so i will be able to just change the connection string. do you know that kind of solution? – Omtechguy Jan 30 '13 at 15:04

1 Answers1

0

ADO.NET uses a connection string to connect to a datasource. The default connection string is defined in the Web.config. The DAL will use this to connect to the database. The server that ado.net connects to can be anywhere so long as the correct ports are opened on firewalls etc.

If your dal is in a separate assembly then you can write a simple DAL web app that references the DAL.BLL and exposes the required methods and objects as web services - either use a RESTFUL approach, SOAP, WCF, simple ASHX - whatever you like best. Then in your original app develop a new DAL that instead of using ADO.NET, consumes the web services. Keep the DAL interface the same so you can switch the new DAL in place without changing any BL or UI code.

WCF Dataservices could be your answer - depending on how much refactoring you want to do - http://msdn.microsoft.com/en-us/data/bb931106

Symeon Breen
  • 1,531
  • 11
  • 25
  • But how can i call the DAL from the Web ASP.NET Application? currently my DAL.DLL defined as reference to my application. i want that the dal will be on a different serer for security reasons. – Omtechguy Jan 31 '13 at 16:25