5

After reading the question How can I conditionally compile my C# for Mono vs. Microsoft .NET? and seeing this great answer

I was wondering if there is a way to compile using both sqlite for .NET and monos version. On windows I shouldnt require monos lib to exist and on mono systems/runtime i should only need monos reference. The next part is in code i am using namespace System.Data.SQLite OR Mono.Data.Sqlite I cant do both because of name and class collision.

I'm unsure what to do. Maybe i should use monos version but than I don't want to find out the hardware if i must use the mono runtime for that reference (which has a fair chance of being required). How do i use SQLite in a way that runs on windows and on mono?

Community
  • 1
  • 1
  • Mono.Data.Sqlite does work on windows under the 3.5 runtime. It is only 4.0 that it goes wrong due to security settings. Could link against both and choose which implementation at runtime? – IanNorton Mar 14 '12 at 07:54
  • see: https://bugzilla.xamarin.com/show_bug.cgi?id=2148. M.D.S works well on windows and linux for me under 3.5 so this patch to it should "fix" it for 4.0 – IanNorton Mar 14 '12 at 07:58
  • @IanNorton: So your saying to reference monos sqlite reference instead of sqlite.phxsoftware.com reference? If so post it as an answer, i'll accept. –  Mar 14 '12 at 22:20

1 Answers1

2

Mono.Data.Sqlite works on windows, linux and OSX ( and perhaps solaris too ). You should be able to replace System.Data.Sqlite with it, (SDS was a fork of MDS I think)

System.Data.SQLite I think is fully managed code. While Mono.Data.SQLite is a managed wrapper around the real sqlite C library. For my use this library is slightly faster than the fully managed one.

IanNorton
  • 7,145
  • 2
  • 25
  • 28
  • It doesnt seem to work. I wrote another question two in case i just set it up wrong http://stackoverflow.com/questions/11462465/mono-sqlite-w-o-mono-on-windows –  Jul 13 '12 at 00:10