Actually, using [ ] is specific to your database (probably SQL Server from the way your queries look). Instead of using [ ] you should really use NH's database-neutral equivalent of ` (back-tick, the character usually on the same key as the tilde ~ on most keyboards) as the character to surround your table alias. This will permit your mapping layer to work with databases for which the brackets aren't the character sequence used to surround compound names or other special use-cases. With SQL Server, the ` will be replaced with [ ] but for other DB targets supported by NH the ` will be replaced with the appropriate equivalent for that other database platform.
e.g., use the database-portable....
`MyTable`
...instead of the sql-server specific....
[MyTable]
HTH,
-Steve B.
On Thursday, September 6, 2012 9:08:55 AM UTC-4, Jon Levett wrote:
Thanks to a suggestion on SO, I managed to fix this by placing [] brackets around the table alias.