Click here to Skip to main content
15,919,422 members
Home / Discussions / C#
   

C#

 
GeneralRe: Addition Pin
sardonicus3-Oct-04 14:55
sardonicus3-Oct-04 14:55 
GeneralRe: Addition Pin
eggie53-Oct-04 15:26
eggie53-Oct-04 15:26 
GeneralRe: Addition Pin
David Stone3-Oct-04 19:28
sitebuilderDavid Stone3-Oct-04 19:28 
GeneralRe: Addition Pin
benjymous3-Oct-04 22:19
benjymous3-Oct-04 22:19 
GeneralRe: Addition Pin
Nnamdi Onyeyiri4-Oct-04 1:23
Nnamdi Onyeyiri4-Oct-04 1:23 
GeneralRe: Addition Pin
benjymous4-Oct-04 1:31
benjymous4-Oct-04 1:31 
GeneralRe: Addition Pin
David Stone4-Oct-04 4:54
sitebuilderDavid Stone4-Oct-04 4:54 
GeneralDesign Question - Business Object Layer and Data Access Pin
matthias s.3-Oct-04 12:38
matthias s.3-Oct-04 12:38 
Hi,

I have to write an application which extensively uses an SQL Database. For a simple example say I have the following tables with the appropriate fields.

1. Company (ID, Name, AddresseInfoID)
2. AddresseInfo (ID, Street, City, Zip)

(Those two obviously have a relationship)

Now I'd go and create an object called Company and one for the AddresseInfo. AddresseInfo would be a public member of Company.

Usually you'll have more than one company to manage so I create a strongly typed collection called CompanyCollection.

Now on to the questions:
1. Should each individual object be responsible of loading and saving it's data from and to the database or should the CompanyCollection take care of it (which IMHO seems a lot less coding to me on first sight)?

2. Assumed the Collection takes care of the data-fetching, how should then the data changes whithin the individual objects be handled? What comes in mind is either a IsDirty property of each of the BusinessObjects (Company and AddresseInfo) (which can be checked by the collection) or an event (say DataChanged) to which the collection would hook up.

The problem I see with this approach is the following. Say my MDI GUI displays a list of all Companies in a TreeView on the lefthandside. On DoubleClick the selected BusinessObject gets displayed in a new "Document Window" which hosts a PropertyGrid control. Now my user opens 3 Companies and changes the data of all of them. How would I then handle the situation when he only wants to save to of those documents?

Here is some additional information which I feel might be usefull:

a. The amount of BusinessObject loaded from the Database is never really huge. Say a maximum of 2000 objects.

b. BusinessObjects might contain collections of other BusinessObjects, e.g. the Company object will contain a EmployeeCollection.

c. The amount of different BusinessObjects will probably not exceed 20.

d. Performance issues are not a knock out criteria.

e. The solution that I'm after is simple to code and maintain. I don't actually want to create a huge Framework with hundrets of classes which provide for unlimited scalability and the forth. We are talking about an application which is used by 10 people and new versions can be installed at any time if required.

I hope someone can give me some advice on how to design this properly.

Thanks in advance,

Matthias


If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)

GeneralRe: Design Question - Business Object Layer and Data Access Pin
sreejith ss nair3-Oct-04 20:06
sreejith ss nair3-Oct-04 20:06 
GeneralRe: Design Question - Business Object Layer and Data Access Pin
hatim_ali3-Oct-04 20:07
hatim_ali3-Oct-04 20:07 
GeneralRe: Design Question - Business Object Layer and Data Access Pin
Serge Lobko-Lobanovsky4-Oct-04 1:07
Serge Lobko-Lobanovsky4-Oct-04 1:07 
GeneralReading word document whit C# Pin
evalle5053-Oct-04 12:35
evalle5053-Oct-04 12:35 
GeneralRe: Reading word document whit C# Pin
sreejith ss nair3-Oct-04 20:54
sreejith ss nair3-Oct-04 20:54 
GeneralRe: Reading word document whit C# Pin
Anonymous4-Oct-04 5:00
Anonymous4-Oct-04 5:00 
GeneralDrawing outside of your Form!! Pin
RichiLloyd3-Oct-04 10:33
RichiLloyd3-Oct-04 10:33 
GeneralRe: Drawing outside of your Form!! Pin
benjymous4-Oct-04 2:07
benjymous4-Oct-04 2:07 
GeneralPassing databaseName to crystal report Pin
amgad_fathy3-Oct-04 8:52
amgad_fathy3-Oct-04 8:52 
GeneralRe: Passing databaseName to crystal report Pin
Heath Stewart3-Oct-04 9:18
protectorHeath Stewart3-Oct-04 9:18 
GeneralDataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name REPORTTO Pin
macsgirl3-Oct-04 8:45
macsgirl3-Oct-04 8:45 
GeneralRe: DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name REPORTTO Pin
Heath Stewart3-Oct-04 9:14
protectorHeath Stewart3-Oct-04 9:14 
GeneralAvoiding Win32 dependancy Pin
Andres Coder3-Oct-04 6:03
Andres Coder3-Oct-04 6:03 
GeneralRe: Avoiding Win32 dependancy Pin
Heath Stewart3-Oct-04 9:13
protectorHeath Stewart3-Oct-04 9:13 
Generalregex question Pin
g00fyman3-Oct-04 3:13
g00fyman3-Oct-04 3:13 
GeneralRe: regex question Pin
Not Active3-Oct-04 5:20
mentorNot Active3-Oct-04 5:20 
Generalcharacter escaping problem Pin
sween33-Oct-04 3:10
sween33-Oct-04 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.