Migration: Changes Related to IAdvancedDocumentSessionOperations
Changes made to Advanced session operations are cosmetic and are related to abstracting the JSON serialization layer. You can read more about it here. Beside JSON serialization changes, starting from version 5.0, the Session starts to track CompareExchange values and because of that the 'UpdateCompareExchangeValue' is no longer needed.
EntityToBlittable
This property is gone and was substituted by the JsonConverter
property with ISessionBlittableJsonConverter
type. The converter contains following methods:
ToBlittable
- similar toEntityToBlittable.ConvertEntityToBlittable
FromBlittable
- similar toEntityToBlittable.ConvertToEntity
PopulateEntity
RemoveFromMissing
Clear
If you were using the EntityToBlittable
then please just switch to the new JsonConverter
and take leverage from one of the new methods with similar functionality.
ClusterTransaction
In ClusterTransaction the UpdateCompareExchangeValue
method was removed. The method is no longer needed, because the Session, starting from version 5.0 keeps track of the changes to compare exchange values.
To give an example. in version 4.x following flow was valid:
var user = DocumentSession.ClusterTransaction.GetCompareExchangeValue<User>("users/ayende");
user.Value.Name = "New Name";
DocumentSession.ClusterTransaction.UpdateCompareExchangeValue(user);
DocumentSession.SaveChanges();
Starting from 5.0 the flow is simplified:
var user = DocumentSession.ClusterTransaction.GetCompareExchangeValue<User>("users/ayende");
user.Value.Name = "New Name";
DocumentSession.SaveChanges();