Hmmm I think I see an idea now, looking at how the Configuration is created I see how the SqlCreateStrings are called.
What I need is to define a generator with a parameter for AllColumnNames and then a seperate one for TableName and ColumnName and then use AllColumnNames to generate the SqlCreateStrings. That should work fine. Thanks Fabio. On Mon, Aug 10, 2009 at 11:02 AM, Chris Nicola <[email protected]> wrote: > That was what I was wondering. Is this part of the expected behavior of > TableGenerator? It seems to only be an issue with the DDL script > generation. Other than that the TableGenerator functions as I need it to. > > I am guessing I need to change something in SqlCreateStrings() and > SqlDropStrings(), but I am not exactly sure what. > > public string[] SqlCreateStrings(Dialect dialect) { > return new[] { > "create table " + tableName + " ( " + > columnName + " " + > dialect.GetTypeName(columnSqlType) + " )", > "insert into " + tableName + " values ( 1 )" > }; > } > > The problem is it always uses the same table just different columns. The > DDL I would need it to return is something like > > create table zSysCounters (InvestSpec INTEGER, InvestPrice INTEGER) > insert into zSysCounters values ( 1 , 1 ) > > Thanks, > Chris > > > > On Mon, Aug 10, 2009 at 10:19 AM, Fabio Maulo <[email protected]>wrote: > >> Note: you have inherited the behaviour of NHibernate.Id.TableGenerator >> that mean you should know what the behaviour is. >> If you want your own generator you should >> implements IPersistentIdentifierGenerator and IConfigurable (if needed) with >> all you need for your custom generator. >> >> 2009/8/10 Chris Nicola <[email protected]> >> >>> I've tried this with HBM mapping files and the result is the same HBM2DDL >>> only creates one column for the first generator it sees and ignores the >>> parameters after that. The generator is configured correctly however as it >>> is trying to get a value from the correct column. >>> >>> I will probably just have to execute a script against SQLite before >>> testing. >>> >>> >>> >>> >> >> >> -- >> 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 -~----------~----~----~----~------~----~------~--~---
