C#: Good free (no gpl!) ActiveRecord lib

407 Views Asked by At

The question is quite easy, I would like to develop a program (winforms) that will use a database widely, it will use System.Data.SQLite (or the lib should support sqlite in some way, even if imply writing queries by myself) and I like the approach used with ActiveRecord (well, I used it in cakephp, not in ruby)

I read about "Castle" framework but it says it requires NHibernate and I don't know licenses problems and things like that about NHibernate (and I don't know how it works!)

I found this page that is suggesting a lot of frameworks... but I don't have a clue on what should I choose: http://csharp-source.net/open-source/persistence/castle-activerecord

Do those ActiveRecord libs support database "caching" (storing things on some collections in c#) to avoid re-query each time?

Thanks for any suggestion

Important thing: I don't want to relase source code and possibly I would like to use a free framework, program won't cost more than 500-600€... I can't afford a license (it's for a "relative", I can't sell it at normal cost)

Should possibly support database Views in some way (SQLite has some problems with types in this case)

Update 1: I'm ok with not using SQlite if there is a way to have a single-file database like SQLite do, obviusly I've problems with licensing... and I would like to use queries like MySQL (MSAccess is slightly different and requires office)

3

There are 3 best solutions below

0
On BEST ANSWER

Although I wrote "no gpl" in the question, I understand that I misunderstood the "LGPL" license, which doesn't need that you have to release your application sourcecode but only modification to the lgpl'ed sourcecode... this is very interesting (does this thing apply to GPL too?).

After reading this, I pointed to Castle ActiveRecord (based on NHibernate) which is actually very good

However, examples on the website are "out to date" not for "castle" side but for "nhibernate" side, in fact all connection strings and configuration are incomplete/wrong, and doesn't work well with .NET 4.0 because you have to know how to run System.Data.SQLite under .NET 4.0 while is developed in .NET 2.0. While it sounds hard you only have to edit app.config file with 1 line so it's not a big trouble.

However you have to understood all these mistakes, by watching the debugger and exceptions you get. After 3-4 hours of searches/tests/things like that I managed to make it work with sqlite and mysql (test with mysql before which is easier).

Really nice, I hope that this answer will be useful to others too.

Special thanks to Michael Maddox

3
On

SubSonic is an ORM that is

  • Free
  • Licensed under New BSD and MS-Pl, so you don't have to release changes to the source
  • Supports the ActiveRecord pattern (as well as a couple other patterns)
  • Works with SQLite
  • Seems to have a low learning curve
1
On

Why not just use LinqToSql or LinqToEntities with a SQL CE 4.0 database?

All of these are provided by Microsoft as part of Visual Studio 2010, so you won't have any licence issue.