Generating id using the async session

29 views
Skip to first unread message

Oren Eini (Ayende Rahien)

unread,
Mar 11, 2012, 10:01:21 AM3/11/12
to ravendb
Guys,
Currently, using the async session, it isn't possible to generate nice ids during the call to Store().
This is because we might need get a new id, and that is a potentially async operations.
To resolve that, we generate ids such as foo/guid.

What I suggest changing is to have the Store on the AsyncSession NOT set the id, rather, the ID will be available for the async session only after SaveChangesAsync has been called.

Thoughts?

Itamar Syn-Hershko

unread,
Mar 11, 2012, 10:33:54 AM3/11/12
to rav...@googlegroups.com
+1.

There already is a behavior difference between the APIs, and what you suggest is the least worst case

Isn't there a good way to still generate IDs during async store? i.e. use a mutex to lock all sessions if the doc store initiates a new hilo ranges negotiation?

Oren Eini (Ayende Rahien)

unread,
Mar 11, 2012, 10:38:15 AM3/11/12
to rav...@googlegroups.com
Itamar,
No, there isn't.
This is what we actually do in the standard async API, but we can't do this in the Silverlight API.

Chris Marisic

unread,
Mar 12, 2012, 11:35:05 AM3/12/12
to rav...@googlegroups.com
Sounds very reasonable.
Reply all
Reply to author
Forward
0 new messages