问题
I do a good deal of work with an Interbase server. I would like to develop a data access layer for it using NHibernate but there isn't a readymade dialact for Interbase.
Does anyone know, is there an NHibernate dialect which is used for generic ANSI-only database work, or if any of the existing dialects will work okay with Interbase?
Or on the other hand, what kind of work is required to create a new dialect?
Thanks for any advice you can provide.
David
回答1:
You can try with GenericDialect
.
In any case, I suggest you take a look at the existing dialects at https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate/Dialect and write one for Interbase, that you can then share with the community. It's not hard.
回答2:
The Firebird dialect is probably fairly close. Start with that, and tweak it if necessary.
Disclaimer: I haven't tried this. The ADO.NET provider will be different for IB, so theory and practice may diverge. But the SQL syntax for IB and Firebird are less different than the other options on the list.
回答3:
I wasn't satisfied with any of these answers so when I had a spare day at work between projects I gave it a go myself.
The Firebird dialect works completely fine. There are a few things (like trim) that don't carry across nicely into interbase sql. These can simply be avoided as the benefits of using an ORM widely outweigh the alternatives.
We use the IBProvider driver at our company. Not free, but lightning fast and doesn't crash our applications like the previously used Data Direct driver. IBProvider uses an oledb driver, which is supported by default by NHibernate.
来源:https://stackoverflow.com/questions/3256955/nhibernate-dialect-for-interbase