ASP.NET 2.0 Custom Profile Provider

D

Darius

Hello

I implemented custom profile provider based on the example at
http://msdn2.microsoft.com/en-us/library/ta63b872.aspx. It reads Profiles
values from tables in Sql Server.

Everytime when I read Profile property (e.g. string Name =
Profile.FirstName) GetPropertyValues function is called. However after this
function SetPropertyValues is also called. It does not make sense why this
method should be called even if I do not update Profile properties. It just
adds additional overhead to the database server. Does someone has an
explanation about this?

Darius
 
G

Glenn

I was having the exact same issue. What really concerned me was that
the IsDirty flag was true even though none of the property values were
modified.

According to http://www.123aspx.com/redir.aspx?res=33957 :

"...if you are storing anything besides strings, DateTime classes, or
primitive types, it becomes impossible for the ProfileModule to
determine whether the content has actually changed, and it is forced to
write the profile back to the data store every time it is retrieved."

Basically, you have to set automaticSaveEnabled="false" in your <profile
> configuration in web.config and then explicitly call the Profile.Save
method when you want to save the profile information. Additionally, it
appears that you have to explicitly set IsDirty = false within the page.

This seems to work even though it's a bit clunky.

Thanks,
Glenn
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top