Session.IsLoaded returns false on new objects.

16 views
Skip to first unread message

Kyle Levien

unread,
Apr 23, 2018, 3:26:56 PM4/23/18
to RavenDB - 2nd generation document database
Wondering if this is expected behavior for Session.IsLoaded(string id)
I had assumed that if I Session.Store(obj) with a pre-defined Id, IsLoaded(Id) on the same session later would return true.
It appears to be false because the documentInfo.Document is null for newly stored objects.

From the Ravendb 4.0 source:
internal bool IsLoadedOrDeleted(string id)
        {
            return DocumentsById.TryGetValue(id, out DocumentInfo documentInfo) && documentInfo.Document != null ||
                   IsDeleted(id) ||
                   IncludedDocumentsById.ContainsKey(id);
        }

Should this be documentInfo.Entity != null? Or is there an exposed collection I could use in a session override to detect newly created objects?

Thanks,
Kyle

Oren Eini (Ayende Rahien)

unread,
Apr 23, 2018, 3:39:57 PM4/23/18
to ravendb
I think that this is a bug, yes. Probably need to be if Document != null || Entity != null
Can you send a PR?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
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.

Kyle Levien

unread,
Apr 23, 2018, 3:52:13 PM4/23/18
to RavenDB - 2nd generation document database
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Apr 23, 2018, 7:03:04 PM4/23/18
to ravendb
Thanks, merged
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages