Reputation: 3929
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
Upvotes: 0
Views: 610
Reputation: 32104
Actually, the AspNetSqlProfileProvider
(of type System.Web.Profile.SqlProfileProvider
) is added by default in machine.config
. Take a look at your C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
directory (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:
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider" />
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 remove
is that it requires a name
attribute, which you may not know. Using clear
removes all previously registered profile providers, using remove
removes 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).
Upvotes: 2
Reputation: 26956
Following on from RWWilden's answer, there is a SQL Table Profile Provider available, that does map properties into columns in a database:
ScottGu had a brief introduction to them here:
Upvotes: 1