问题
So I need to add two new properties to the Profile object for asp.net membership.
I added these two items to the properties tag in web.config.
<group name="Terms">
<add name="Promotions" type="Bool" serializeAs="String" />
<add name="AcceptedTerms" type="Bool" serializeAs="string" />
</group>
In my code behind I am able to do Profile.Terms.Promotions
and call Profile.Save() with no exceptions.
However, the aspnet_Profile table does not seem to have the updated properties.
Do I need to run something on the actual database, like an update script of some sort?
Thanks in advance!
Edit by Jack:
So I found out it's an issue with my development database server. For some reason Profile info is not saving properly. So this is a whole other issue ha
回答1:
Membership profile uses it's own method of generating a serialized profile object that represents the properties you require. On objects that have already been created in the database the new properties might not be present until they have been re-saved.
回答2:
The aspnet_Profile table serializes everything as a BLOB- it doesn't add new columns. It does this because it means the DB does not need have its schema changed.
Of course you change this behaviour quite easily- here is one such article describing how to do it.
来源:https://stackoverflow.com/questions/1478906/asp-net-membership-how-do-i-add-a-new-property-to-aspnet-profile