Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6800513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:58:42+00:00 2026-05-26T18:58:42+00:00

I’m currently on the analysis phase of a project I need to complete for

  • 0

I’m currently on the analysis phase of a project I need to complete for a course, so it doesn’t just have to work, it needs to have good class design, OOP good practices and all that.

It’s a desktop program (C# and WPF) with access to a local, single-file, single user database (SQL Server CE).

My domain has a master table containing “documents”. I want the user to open a single document from the database, and that will retrieve from the database and store in memory the complete graph: each single document object has various collections of “son” and “grandson” objects. From memory to user interface, where the user will be free to manipulate the document but it’ll only be persisted when the user clicks on “Save”, just as a Word document, for example.

Other question: giving the nature of the application, it’s be best to open a connection to the database and keep it open for as long as the application is running, or it would be best to open a connection only when the app is actually saving or reading data?

I’m not looking to see my problem implemented, just some suggestions for good design patterns relevant to my domain (links would be good, too). Also, the domain is quite simple so I could implement those patterns myself without using a OR/M framework such as NHIbernate or Castle (in fact I believe NHibernate is too much of a hassle for a simple problem like this), but I wouldn’t be against some simple, small and easy persistence framework.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:58:43+00:00Added an answer on May 26, 2026 at 6:58 pm

    I would abstract the database into a Connection Factory pattern object. That way you can create connection objects as needed, and they can destroy themselves when they go out of scope.

    Doing it that way means that you can use a persistent connection, or constantly make a bunch of new connections. It doesn’t matter because the implementation is abstracted away.

    That being said, I’d probably implement it as a persistent connection – there’s overhead associated with making a new connection for every single query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.