HighTechTalks DotNet Forums  

mapping data onto an inherited structure

Dotnet Distributed Applications microsoft.public.dotnet.distributed_apps


Discuss mapping data onto an inherited structure in the Dotnet Distributed Applications forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Owen Richardson
 
Posts: n/a

Default mapping data onto an inherited structure - 05-09-2006 , 03:57 AM






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

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: mapping data onto an inherited structure - 05-09-2006 , 09:23 PM






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.)


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.