SQLite Versioning Configuration Question

Mark Bonano's Avatar

Mark Bonano

07 Sep, 2010 06:43 PM via web

I am trying to use SQLite (version 3 in-memory db) within my
integration tests, but my tests consistenly fail throwing the
following message:

System.Data.SQLite.SQLiteException : Abort due to constraint violation
Version may not be NULL

I have mapped a very simple object using optimistic concurrency as
follows:

Id(x => x.Id).GeneratedBy.GuidComb(); ... OptimisticLock.Version(); Version(x => x.Version)

          .Column("Version")
          .UnsavedValue("null")
          .CustomSqlType("timestamp")
          .Generated.Always();

When I run my tests against MS SQL Server, the insert statement that
is generated does not pass a value for the 'Version' field. SQLServer
creates a binary value and inserts that value into the 'Version' field
automatically.

When I try to run my tests against my SQLite in-memory db, however,
the binary value is not auto-generated by SQLite. (which leads to the
aforementioned exception)

Is there any way to map an object so that the Version field auto
generates a binary value for both MS SQL Server and SQLite? Any help
is MUCH appreciated!

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      What comes next? 'Monday Tuesday Wednesday ?????'