We do have types as well – I omitted all of that extra stuff from the model just to simplify it.  We actually also maintain a normalized table full of types, so the attributes table would have a type_id field as well.

 

Our length for that field is generally VARCHAR(255).  It’s been plenty thus far.

 

As far as the object model, our user objects would have a property named Attributes that returns the query listed earlier.  We don’t actually use them this way because that’s not needed in our model.  But if it *were* to be a part of our paradigm, it would work like this:

 

User

            String .Name

            String .ID

            Query .Attributes

            String .GetAttribute(String Name)

            Void SetAttribute(String Name, String Value)

 

Roland

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Chastain
Sent: Thursday, June 29, 2006 4:46 PM
To: [email protected]
Subject: RE: [CFCDev] Modeling a user and its profile

 

So do you model this in an OO fashion or is this all database design?  I am thinking specifically on the attribute ... is there different types of attributes (i.e. email, plain text, date, etc.)?  Is there any checking / validation of the attribute?  How are you storing the attribute in the database table ... are all attributes expected to fit in a varChar(50) field?

 

Thanks

-- Jeff

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roland Collins
Sent: Thursday, June 29, 2006 3:31 PM
To: [email protected]
Subject: RE: [CFCDev] Modeling a user and its profile

We use lookup tables.  A simplified version of our ERD is attached.

 

Basically, you normalize the attributes into a separate table and then use a one-to-many reference table to map users to their attributes.  For the attached ERD, you can pull a user’s attributes with this query:

 

SELECT u.user_id,

            a.attribute_id,

            a.nm,

            ua.value

FROM (users u INNER JOIN user_attributes ua

            ON u.user_id = ua.user_id) INNER JOIN attributes a

            ON ua.attribute_id = a.attribute_id

WHERE u.user_id = @user_id

 

HTH,

Roland

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Chastain
Sent: Thursday, June 29, 2006 3:54 PM
To: [email protected]
Subject: [CFCDev] Modeling a user and its profile

 

I am working on a portal type application where a "user" will really only be made up of a username and a password.  That user will then have a profile which would contain other standard details like the user's name, address, email, etc.  The question I am faced with is that for different instances of this application, the application admin needs to be able to customize the contents of the user profile.  For example, via a web interface, admin A can set his user profile to contain the user's first name, middle initial, last name, and email address.  Admin B however would be able to set his user profile to also contain the user's home address, work address, and phone number.

 

So, I can see a user profile type object here, but how do you dynamically assign properties to that user profile without having any idea what those properties might be at design time?  Anybody modeled or seen anything like this before?

 

Thanks

-- Jeff

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to