Just in case...here was my [quickly written] implementation: public void Apply(IIdentityInstance instance) { var tableClause = string.Format("TableName ='{0}'", instance.EntityType.Name); instance.GeneratedBy.HiLo("UniqueKeys", string.Format("NextHi_{0}", instance.EntityType.Name), "1000", p => p.AddParam("where", tableClause)); }
On Sep 15, 2:17 pm, Sean Gough <sdgo...@gmail.com> wrote: > Was worth a try, but unfortunately you still end up with one column > and one row in the database. Even worse, it's the last entity to get > mapped (say OrderNextHi) and other entity actions fail (since they are > looking for their own columns). > > Looks like the only way to do this will be to write a custom generator > that inherits from HiLo, or extend HiLo somehow. > > Cheers, > -Sean > > On Sep 13, 8:32 am, Paul Batum <paul.ba...@gmail.com> wrote: > > > Hi Sean, > > > Have you tried using the xml that was suggested in that post? If that works, > > then I think this would do it: > > > instance.GeneratedBy.HiLo("1000", p => p.AddParam("where", "TableName = > > 'Customer'")); > > > Although because its a convention you'll have to do some string > > concatenation because it can't be 'Customer' every time. > > > Let me know if it works (or not :D ) > > > Paul Batum > > > On Sat, Sep 12, 2009 at 3:48 AM, Sean Gough <sdgo...@gmail.com> wrote: > > > > Thanks Paul! > > > > I am not 100% certain what the xml would look like, but I'm > > > essentially trying to do what is described here: > > > >http://stackoverflow.com/questions/1356736/nhibernate-hilo-one-table-... > > > > On Sep 11, 12:14 pm, Paul Batum <paul.ba...@gmail.com> wrote: > > > > Sean, > > > > > I haven't really worked with hilo but there is a good chance I can > > > > assist > > > > you if you can show me the desired mapping xml. > > > > > Paul Batum > > > > > On Sat, Sep 12, 2009 at 2:06 AM, Sean Gough <sdgo...@gmail.com> wrote: > > > > > > I can't for the life of me seem to get this to work. Anyone have any > > > > > ideas? I don't want to have to resort to mapping files or explicit > > > > > mapping. > > > > > > On Sep 9, 5:40 pm, Sean Gough <sdgo...@gmail.com> wrote: > > > > > > Thanks, I tried that also. Those parameters control the table name > > > > > > and column name for all entities, so I end up in the same boat. I > > > > > > also tried dynamically changing the column name with the name of the > > > > > > entity (i.e. customer_next_hi, order_next_hi) but ended up with a > > > > > > table with only one column still, named after the last entity > > > > > > mapped. > > > > > > > I assume (maybe incorrectly) that I can use the Action<ParamBuilder> > > > > > > parameter to control the next_hi column (or is it row?) name used > > > > > > for > > > > > > a given entity but haven't figured out how to do so yet. > > > > > > > Cheers, > > > > > > -Sean > > > > > > > On Sep 9, 5:34 pm, Barry Dahlberg <barry.dahlb...@gmail.com> wrote: > > > > > > > > Check out the overloads on the HiLo function, e.g. > > > > > > > > instance.GeneratedBy.HiLo("Table", "Column", "1000"); > > > > > > > > Barry > > > > > > > > 2009/9/10 Sean Gough <sdgo...@gmail.com> > > > > > > > > > Hi everyone, > > > > > > > > > I have the following id generation convention... > > > > > > > > > public class IdGenerationConvention : IIdConvention > > > > > > > > { > > > > > > > > public void Apply(IIdentityInstance instance) > > > > > > > > { > > > > > > > > instance.GeneratedBy.HiLo("1000"); > > > > > > > > } > > > > > > > > } > > > > > > > > > When using this though, all entities go off the same next_hi > > > column. > > > > > > > > I've read that you can have individual next_hi values for each > > > entity > > > > > > > > by using the "where" clause in your mappings, but I can't seem > > > > > > > > to > > > > > > > > figure out how to do it fluently. Can anyone help? > > > > > > > > > Thanks in advance! > > > > > > > > > Cheers, > > > > > > > > -Sean --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---