473,473 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

table to object converter

Hi,

I have a sample class – let’s say Person.

It has the following fields:

Id:int
Name:string
Address:string

I would like to reuse this class over different projects. In all of them I
need to bee able to store and retrieve the Person’s fields into/from a Data
Base.

All Data Bases’ “Person” Tables would have the same field types but different
field names. Example:

DB1>tblLondonCitizen:

londonCitizenID:int
londonCitizenName:string
londonCitizenAddress:string

DB2>tblHuman:

humanID:int
humanAddress:string
humanName:string

My idea is as follows:
Use a typed “Person” DataTable for each project and then build a “dbToPerson”
converter class. It should be able to receive a typed “Person” DataTable and
return a Person object collection; or receive a Person Object collection and
return a typed “Person” DataTable.

What bothers me a little here is that I should copy and do small changes to
this “dbToPerson” converter class for each project.

I would be glad to get feedback for an alternative way or improvements on
this one,

Thanks in advance,
Albert

--
Albert Benatov
Skype: abentov
http://albertbenatov.com

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200606/1
Jun 15 '06 #1
2 2020
Hi,

There are plenty of tools around that help you do this. If you look in the
archives you will find recommendations for several of those.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"abentov" <u18435@uwe> wrote in message news:61cdd5663a701@uwe...
Hi,

I have a sample class - let's say Person.

It has the following fields:

Id:int
Name:string
Address:string

I would like to reuse this class over different projects. In all of them I
need to bee able to store and retrieve the Person's fields into/from a
Data
Base.

All Data Bases' "Person" Tables would have the same field types but
different
field names. Example:

DB1>tblLondonCitizen:

londonCitizenID:int
londonCitizenName:string
londonCitizenAddress:string

DB2>tblHuman:

humanID:int
humanAddress:string
humanName:string

My idea is as follows:
Use a typed "Person" DataTable for each project and then build a
"dbToPerson"
converter class. It should be able to receive a typed "Person" DataTable
and
return a Person object collection; or receive a Person Object collection
and
return a typed "Person" DataTable.

What bothers me a little here is that I should copy and do small changes
to
this "dbToPerson" converter class for each project.

I would be glad to get feedback for an alternative way or improvements on
this one,

Thanks in advance,
Albert

--
Albert Benatov
Skype: abentov
http://albertbenatov.com

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200606/1

Jun 15 '06 #2
Ok Thanks,

What would the search term be - "object to database converter" or "object
converter"?

--
Albert Benatov
Skype: abentov
http://albertbenatov.com

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200606/1
Jun 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mark Rae | last post by:
Hi, Can anyone please tell me how to convert an object say, a System.Web.Mail.MailMessage object, to a byte array and then convert the byte array to a Base64 string? Any assistance gratefully...
8
by: vbMark | last post by:
When using regular, non .NET asp, I would write an ActiveX DLL COM object in Visual Basic 6 to do all the work on the server. Now I am using ASP.NET with C# and want to do the same. Which C#...
3
by: Michael Stahl | last post by:
What I want to do: I want to have a class which is reading an .ini file and manipulate the application with the data from the ini file. What I have now: An ini file: Text=Hallo Dock=none
3
by: Lance | last post by:
Hi, Sorry for the confusing subject, but here is what I am after: I am using the 'System.Drawing.FontStyle' object, and I would like the caller of the function to be able to decide when calling...
0
by: Billy Greening | last post by:
Hi, I have this audio converter com object I am trying to use. In order to get the progress of the conversion it uses some converter.setCallBack function that expects a 'obj lpProg'. Their...
8
by: Vik | last post by:
I need to make some calculations, e.g. addition, on the objects x and y which are numbers (of the same or different types) and may be DBNulls. In VB, the following code is correct: Public Shared...
3
by: Alex | last post by:
Hi all, I'm trying to create an arraylist of a user control class... I'm able to define the list and add objects (panels) to it, but I can access and of the panel properties using an index... ...
2
by: =?Utf-8?B?TWFyZWs=?= | last post by:
Hi I have a class which has its own type converter that adds some additional properties using overridden GetPropertiesSupported and GetProperties methods. All works fine if an instance of the...
4
by: buzzluck68 | last post by:
Hello, I am having trouble upgrading my VB apps to .net. When i started at my company there was a dll created here in vb6, and i need to use that dll for many functions that would take too much...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.