By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,087 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

ASP.NET 2.0 Custom Profile Provider

P: n/a
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


Nov 3 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Darius wrote:
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

Nov 3 '06 #2

P: n/a
great stuff Glenn, I will follow your advice. Thanks a lot!
"Glenn" <gl***@foo.barwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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

Darius wrote:
>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
Nov 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.