entity and foreign key

J

Jeff

hi

asp.net 2.0

I have a table, (lets call the table "Car") which links to the aspnet_Users
table. (UserId)

I'm creating an entity class of the car table, containing all the fields in
the car table, except that I'm unsure what to do with the field linking to
aspnet_users. I mean I can just use the UserId column, but in my website I'm
not displaying UserId, but UserName....

I would prefer to add UserId to the entity and then use some other technique
so that the GridView replaces the UserId with the UserName.. as username is
more readable for the humanbeing...

any suggestions?
 
J

Jeff

I know, but I have this GridView based on a custom collection. Lets say a
collection of a Car class (showing information related to cars).

The table which the entity class get it's values from have these fields:
car_id (primary key)
car_make
car_color
car_user (uniqueidentifier), foreign key to aspnet_Users

The car entity has these properties:
car_id
car_make
car_color
car_user (uniqueidentifier)

The enity class holds the same fields as the table

I would prefer if I could make the entity class only have properties which
only is based on the field in which the entity class is based on. This means
that UserName is not put into this entity class..

I know PowerBuilder had a feature for this 6 years ago. There I in a
DataWindow (DataWindow is a data presentation control in PowerBuilder) could
add a id column to the DataWindow. But during runtime get the id column
replaced with another value... Not sure how this could be done in asp.net
2.0 or if it's best practice

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top