|
|
|
The zipped files contains source for Jet Dialect and Driver.
Hmm, should I put this into the core source, or into NHibernateContrib?
By the way, Int64's could probably be turned into strings. Using the dialect should be fairly easy..
Just reference the Nhibernate.JetDriver.dll in your project and set: hibernate.dialect configuration setting to "NHibernate.JetDriver.JetDialect, NHibernate.JetDriver", hibernate.connection.driver_class to "NHibernate.JetDriver.JetDriver, NHibernate.JetDriver" and hibernate.connection.connection_string to standard OLE connection string for MS Access, ie. something like "Provider=Microsoft.Jet.OLEDB.4.0;User ID=xxx;Data Source=path\to\your\db.mdb" The rest should be standard work with NHibernate, you just have to be aware of limitations of MS Access regarding number of foreign keys in the database, query complexity (a beautiful "Query too complex" error from Access when your query contains more than 99 (or 40? I don't remeber exactly) columns or the WHERE expression is "too complex" or there are too many joins in the statement), etc. You also don't want any special characters in column names, because quoting in MS Access doesn't work as one would expect. If you want some working examples, you can change the configuration of tests in nhibernate source to use the dialect :) Most of them should work (after you modify the column names in mapping files). The most complex tests don't work because of the reasons mentioned above. The comment above applies to the version of the dialect present in NHibernateContrib, not the one attached here, that have different namespaces..
First of all, thanks for your dialect. Using NHibernate with Access was a real pain until now.
I can't undesrtand why you mix DbType.Time, DbType.Date and DbType.DateTime and format them using the pattern "dd-MMM-yyyy HH:mm:ss". I had to modify JetDbCommand.cs and format DbType.Time with "HH:mm:ss" and DbType.Date with "dd-MMM-yyyy" in order to get correct inserts into my database. Also, I'm having problems with the Decimal type. I'm Spanish and numbers are expresed 12.345,123 not 12,345.123 like in English culture. But Nhibernate inserts Decimal type in my database in english format. I don't know if this is a problem of this dialect or not. |
||||||||||||||||||||||||||||||||||||||||||||||
These are the limitations of Access dialect:
-- no Int64 support (Int64 is silently converted to Int32, possibly throwing an exception).
-- really no way how to force Access to accept "weird" characters ([$@! etc.) in table/column names even if quoted.
The implementation is not completely finished, I've had no time to register all the SQL functions for the dialect for example, but I hope it is complete enough for other people to start playing with and testing.
I had to implement System.Data.IDbCommand, System.Data.IDbConnection and System.Data.IDbTransaction in order to process everything allright, see class comments in JetDbCommand.
Hope someone will find this useful..