Click to See Complete Forum and Search --> : Program Design


Humar
November 4th, 2008, 03:58 PM
OK,

I have my database made, and also my stored procedures in SQL 2008. Now, when I use to design programs I use to write a Data Provider Interface, and then create a Data Provider (MSSQLProvider) which would handle the communication to the database. I then represented all of the tables in the database as objects in the source code, as they normally were. For example an Employee. So I would have an EmployeeManager which called the Provider.

Its a lot of work and takes a really long time to do this all correctly. I would like to put out a solution fast, and am wondering if there is an easier way to do this now, with C# 2008 EE. Is there any way I can do this without writting all these additional classes and interface, and still have the correct OOP design?

Or am I stuck spending hours doing it the old way?

Humar
November 4th, 2008, 04:25 PM
In looking further I've noticed this LINQ which I added to my project and after playing around with it for a while it appears that I just add the database to my project and bind the data directly to the table fields.

This looks really cool and would save me hours and hours of coding. However, is this a reliable solution for a distributed application? It looks like its attaching itself directly to the database file on my development machine during design time, when this program is installed on a production machine how is the database connection going to be handled so that it does not break the connection to the database?

It also appears to copy the MDF file directly to my solution bin, so changes made to the database via MSE will not be reflected in the program without rebinding everything?

Thread1
November 4th, 2008, 11:12 PM
you can always use the Class Designer to model your application, it automatically takes care of the data access for every class that you will have in the design.

usually the connection string is stored on the application's configuration which you can be changed anytime even after the deployment phase without recompiling your codes.

you may look into the layered design (presentation, domain, data source) which is usually the breeding ground in distributed computing. it offers clean separation of your applications UI, logic, and database access.

hth