Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Fluent NHibernate Support

26 views
Skip to first unread message

lade...@gmail.com

unread,
Jun 21, 2013, 4:22:08 PM6/21/13
to csharp...@googlegroups.com
Hello.  I'm working on putting C#-SQLite underneath NHibernate, and in particular NHibernate's fluent interface.  It's working pretty well, but I had to make a couple small changes to get it to work and I was hoping to get some comments before publishing a bit of info on how to make it work.

Change 1: connection strings

The fluent interface's configuration class, SQLiteConfiguration, constructs a connection string that appears to be incompatible with C#-SQLite in two ways.  Here's the string:

   Data Source=C:\Users\path1\path2\bookmarks.db;Version=3;New=True;

First of all, it uses semicolons to delimit the string.  C#-SQLite seems to expect commas.  My change allows it to accept both.

Secondly, SqliteConnection doesn't seem to want a full local path as a Data Source.  I get an InvalidOperationException (invalid URI) unless WINDOWS_PHONE is defined.  But all I really want is to pass the Data Source value directly to the SqliteConnection, so it seems like the logic should be that it does that when WINDOWS_PHONE is *not* defined.  I swapped the logic on that define and it seems to work.

Change 2: GetSchema() restrictions

Just a little change, but for some reason NHibernate is sending empty restriction values in its GetSchema() call.  I added a quick filter to the incoming values:

   restrictionValues = restrictionValues.Where(r => r != null).ToArray();

Any comments about these changes are most welcome!
Reply all
Reply to author
Forward
0 new messages