btw Delucia that is an improvement of HighLow defined in ORM theory.The
target of the improvement is : has a less fragmentation per table.

In winform and 2 physical  tiers you should use a little max-low (like 99)

2009/9/14 Delucia <[email protected]>

> Currently if I want to insert an object graph that has 2 entities that use
> HiLo for their Id, NH session will go to the database for two times, one
> time for each entity, and increment the next_hi count. I was assuming that
> the session will have to go once to the database and reserve a range to be
> used for all entities since all entities are using the same next_hi value
> that will guarantee they will not collide. here is an example:
>    using (var session = SessionSource.CreateSession())
>             {
>
>                 using (session.BeginTransaction())
>                 {
>                         var customer = new Customer("Joe");
>
>                         session.SaveOrUpdate(customer);
>
>                         var employee = new Employee { FirstName = "Sue",
> LastName = "Wong" };
>
>                         session.SaveOrUpdate(employee);
>                     }
>
>                     session.Transaction.Commit();
>                 }
>             }
>
> Given the max_Lo is set to 1000, this code will go to the database twice to
> increment the next_hi one time for the customer and one time for the
> employee. I think it should increment it only once per session.
>
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to