While working on a project I was using a MsSQL 2012 database for my persistence layer but wanted to use a SQLITE in memory database for my unit/integration testing. As part of my mapping setup I used an NHibernate Version column which used DateTime2:
NHibernate Mapping Code:
Unforntuently SQLITE doesn't support DateTime2. After searching around and not finding a good solution, I ended up extending SQLiteDialect class to map it to TEXT per the following link: http://stackoverflow.com/a/16597386/2544235
SQLiteDialect Code:
Subscribe to:
Post Comments (Atom)
-
While working on a project I was using a MsSQL 2012 database for my persistence layer but wanted to use a SQLITE in memory database for my u...
-
I recently started a project which used the following technologies: Visual Studio 2013 + Angularjs + JasmineJS + Resharper 7/8 (or Chutzpah)...
-
I recently installed windows 10 preview on an old laptop (Dell Precision) which has an Nvidia Quadro 3000M video card. After running window...
Thankyou!
ReplyDeleteI have not delved into exactly how an why it works but in my case it was enough to:
protected override void RegisterColumnTypes()
{
base.RegisterColumnTypes();
RegisterColumnType(DbType.DateTime2, "DateTime2");
}
protected override void RegisterKeywords()
{
base.RegisterKeywords();
RegisterKeyword("DateTime2");
}
I am only (diminishing) using SQLite for automatic testing and I am not sure I check my DateTime2s in my tests. But as long as tests show green I am good to go? Right! Right? Hello? Anybody still listening?