How does ASP.NET profiles handle versioning? I know because the data is serialized this could be a problem where with tables it is not.
Will it throw some sort of serialization error?
Example: I store a v1 object to the profiles. I update my web application with a new v2 version but the database still contains v1 objects.
What will happen when I attempt to deserialize the v1 objects into the v2 objects? And what are the best solutions for this problem?
Typically ASP.NET treats profile data as a property bag - so it would probably skip a property (that has been stored in data store) but deleted from configuration. Similarly, for newly added property, it would use the default value. Now, type of properties will also matter - if property type is your custom class then its serialization will be handled by either XmlSerializer or BinaryFormatter. XmlSerializer is a default and its generally a tolerant serializer (missing properties will be skipped etc). You can use attributes to control xml serialization. In case of BinaryFormatter, its same as runtime serialization and if you wish to support versioning, its best that you implement ISerializable and handle any versioning issues. I am not certain what would happen in a case where you have a profile property of some type A and then you delete that type. My guess is that you should get an error but I am not ceratin about it.
I typically prefer to roll up my own implementation for supporting user profile feature because
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With