Also, if you need escaping on certain identifiers, you can use the NHibernate escape charater ` (backtick) around the identifiers in mapping. NH will convert to the appropriate dialect-specific escape character for SQL.
/Oskar 2017-04-04 19:10 GMT+01:00 Fran Knebels <[email protected]>: > have you set the AutoQuote keywords parameter? > > I use the mapping by code feature. Here's my db configuration > > Configure.DataBaseIntegration(db => > { > db.Dialect<MsSql2008Dialect>(); > db.Driver<SqlClientDriver>(); > db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote; > db.IsolationLevel = IsolationLevel.ReadCommitted; > db.ConnectionString = _connectionString; > db.BatchSize = 20; > db.Timeout = 10; > db.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y', no 'N'"; > }); > > > Note the line db.KeywordsAutoImport = HbmDDLKeyWords.AutoQuote > > > On Tue, Apr 4, 2017 at 1:00 PM, Vazha Ezugbaia <[email protected]> > wrote: > >> i'm using NHibernate.Dialect.MsSql2012Dialect >> it generates query without "[" and "]" symbols >> and sometimes causes SQL error >> >> e.g >> if there is column with name "From" >> it generates query like this >> >> SELECT p.From FROM TS_Ranges p >> >> this causes error "Incorrect syntax near the keyword 'From'." >> >> because correct syntax is >> >> SELECT [p].[From] FROM [TS_Ranges] [p] >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/nhusers. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
