I have a windows form application(c#) and an asp.NET web application which both access Sql Server database. I want to centralize the database access. Which metedologies should i follow? What is the common approach to this issue?
- Writing DAL and Model Libraries and using them in both application?
- Writing WCF service including DAL model and using this service with both applicaiton?
- None of the above?
Can you give me any idea?
Thank you.
I think using the
SOAapproach is really better (WCF or WebServices with a DAL layer) because this way you don’t need to publish your DALdllwith the Windows Formsexe. Then, all changes to your data model will automatically happens to your both UI clients.Remember that this can cause its own problems:
Concern with security so that your Services cannot be accessed directly by URL, allowing someone to run your methods.
Concern about maintenance, because changes in data layer that needs to affect only one interface will be more difficult to control and needs to be better planned before (with the creation of new methods specific to certain intercace).
Decrease in performance, because the HTTP access is always more costly than direct communication with a dll.
Risk of lack of communication with the server, something that is expected to ASP.NET but requires additional concerns in the Windows Forms client to behave properly in these cases.