Need explanation for CreateWizard and Profiles upon insertion into the database

52 views Asked by At

I finally got the CreateWizard and Profile to work on my system, but I am having trouble understanding why properties in the profile are stored in the database the way it is. For example, everything I add to the properites for profile, gets stored into a column called PropertyNames and PropertyValueString.

I am having trouble understanding why they do this. I understand that the propertynames correspond with the propertyvaluestrings, but why don't these get put into seperate columns in the profile table?

What if I want to store these values in columns such as Address or AccountBalance instead of storing it all in one string, how do i keep the PropertyValueString updated if I change the users AccountBalance?

Also when I create a user with the CreateWizard, do I have to manually run a query to insert the extra information into the profile columns (if I extend the original Profile table to have more columns such as FirstName LastName etc)? is there something I am missing here? Also I heard people use these for xml serialization for the Strings, what are the advantages of doing so? Thanks

1

There are 1 answers

0
Geoff Appleford On

Its stored that way so that you can easily add new properties without having to add new columns to your database. It makes adding new stuff really easy at the expense of not being able to easily query the database.

However, you can write your own profile provider to store this info in any way you like. Or use an existing solution such as the the Table Profile Provider (here's how to use it in Asp.net 4 projects)

In fact, if you Google for asp.net profile providers, there are numerous examples of how to write your own provider. Pick one that matches what you want to do.