Q1
Book suggests that before we register new SqlProfileProvider, we should remove any existing profile providers using <clear> element. But:
A) why must we use <clear> instead of <remove>?
B) I assume that root web.config or machine.config don’t register (by default) any profile provider, and thus using <clear> element is not necessary?
Q2
I assume reason why each profile property doesn’t have a corresponding column in a database table ( instead all properties are stored into a single field ) is due to the fact each time we would add and remove profile properties, we would also need to change table schema?
thanx
Actually, the
AspNetSqlProfileProvider(of typeSystem.Web.Profile.SqlProfileProvider) is added by default inmachine.config. Take a look at yourC:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIGdirectory (or another location). However, it is not registered as the default provider there. So if you are satisfied with the default settings, it is enough to use the following configuration:If you want to use a custom provider, it’s usually a good idea to clear all existing providers (although not necessary) and name another default provider.
The reason for not using
removeis that it requires anameattribute, which you may not know. Usingclearremoves all previously registered profile providers, usingremoveremoves just one by name.Concerning Q2 you´re correct. The database scheme that is used must be general enough to accomodate lots of different properties (and types of properties).