Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / May 2006

Tip: Looking for answers? Try searching our database.

mapping data onto an inherited structure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Owen Richardson - 09 May 2006 08:57 GMT
Ok I have a project working now which has a UseData Class which is an
empty datastructure and i have a UserCRUD class which i can use to
prefill it. I have moved up to my Business logic layer and now want to
put all of this together

my UserData class has the following properties
Username
Password
Email

my UserLogin Class inherits from UserData and has the Login and Logout
Methods

I want my UserLogin.Login method to fill the Username, Password and
Email properties of UserLogin from the database

i have UserCRUD.Get(username.password) which returns a UserData
structure - given that my UserLogin Class was inherited from UserData
is there any way i can map the return from UserCRUD.Get directly onto
my UserLogin Class or will i have to do something like

UserLogin myUserLogin=(UserCRUD.Get(user,pass);
this.m_UserName=myUserLogin.Username;
this.m_Email=myUserLogin.Email;

within my UserLogin method? I am basically trying to avoid having to
continually do the above property by property assign, is my approach
ok, or am i being a complete idiot? This is my first attempt at real
OO N-tier project and i am trying to get the theory perfect before i
do something more complicated, apologies if my explination isnt too
good.

Regards
Owen
Kevin Yu [MSFT] - 10 May 2006 02:23 GMT
Hi Owen

As far as I know, we have to do the assigning in code manually. However,
there are some 3rd party tools that can generate the assigning code for
you. Sorry that I could not remember the name, but I think you can find
many of them by searching through google.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.