Can we hardcode the starting number for HiLo?

33 views
Skip to first unread message

Justin A

unread,
May 26, 2012, 12:11:40 PM5/26/12
to rav...@googlegroups.com
Hi Folks,

I understand that we can change the -size- of a HiLo batch/block... but can we determine the starting number, for HiLo?

Why? I'm playing around with some unit tests and have some hard coded fake data. In this data, i'm hardcoding the Id's .. i was hoping to mix-n-match .. so the HiLo can kick off for all new items after my hard coded list.

eg.

Store(new Foo(1));
Store(new Foo(2));
Store(new Foo()); // HiLo will start, with the id being foos/3

Is this possible?

Oren Eini (Ayende Rahien)

unread,
May 26, 2012, 12:38:01 PM5/26/12
to rav...@googlegroups.com
Sure,
As the very first thing you do in the app, do:

session.Store( new { Max = 1024} , "Raven/Hilo/Foos");
session.SaveChanges();

Your hilo ranges will now start after 1024

Justin A

unread,
May 26, 2012, 9:04:51 PM5/26/12
to rav...@googlegroups.com
AHH! tricky :) u manually create the doc/collection :)

awesome!
Reply all
Reply to author
Forward
0 new messages