Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to architect a winforms database application. 1

Status
Not open for further replies.

jtrembla

ISP
Jul 6, 2006
104
US
Ok,

I am seperating my application into the standard 3 ntier layers. It is a winforms application.

My question is how to handle database transactions.

Should I load the entire database into memory and then update the server database when the application closes?

Currently the application updates the database as each value changes in a grid or any fields. Everything is handled via stored procedures.

There are so many different examples that I am hard-pressed to find the best approach.
 
Should I load the entire database into memory and then update the server database when the application closes?
absolutely not. if this was ever needed it should be considered an edge case.

the GUI and DB are independent of each other, with no knowledge the DB even exists. With a layered architecture you would have an MVP/MVC to manage the GUI layer, then you would have a thin service layer to manage requests from the controller to the domain. within the domain you would have all your validation, business logic, factories, repositories, etc.

I like to use the Unit Of Work pattern to manage database connections/transactions. This is a common model used by NHibernate and ActiveRecord. with a web application a unit of work usually equals a request/response. With a desktop app the division is not a clear cut, so you will need to decide where logical units of work are.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top