Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--I tried posting this question an hour or so ago, but can't seem to find it anywhere, so i hope this is not a duplicate.I'm looking for a way to retrieve the unmodified value of a property within a single session.Say i have the following document:
{
"Id": "MyDocuments/1",
"Property": [
"OtherDocuments/2", "OtherDocuments/3"
]
}
I then update it (without saving):
var myDocument = session.Load<MyDocument>(1);
myDocument.Property = new List<string> {
"OtherDocuments/4"
}
In another part of the code (still within the same session though) i would like to:
var unmodifiedProperty = session.Load<MyDocument>(myDocument.Id).Property; // Hoped this would load the unmodified (yet cached) version of the document - but it's the same instance as the one i modified.Is there any way to do this without having to clone the original instance and carry it through the entire workflow?I know the WhatChanged() method can show me the specific changes, but it would require a lot of unnecessary code to recreate the unmodified value from the DocumentChanges objects.
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
_authorizationHandler.EnsureCanSave(modifiedDocument);
Another thought, do you need both bits of data to do the auth check or can it be "bool BeforeValuesMeetAuthCriteria"?
var document = session.Load<MyDocument>(1);
//Do BeforeValuesMeetAuthCriteria here
document.Property = ...
// Do AfterValuesMeetAuthCriteria here
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.