tags:

views:

2924

answers:

5

NHibernate is not really a good fit for our environment due to all the dependencies. (Castle, log4net etc.)

Is there a good lightweight alternative?

Support for simple file based databases such as Access/SQLite/VistaDB is essential.

Ideally, something contained in a single assembly that only references .NET assemblies. If it only requires .NET framework 2.0 or 3.0 that is a bonus.

A: 

Generally speaking, for your database backend to work with .net you need an ADO.Net provider for it.

For MS Access (Jet), the Provider is shipped with .net. For SQLite, there is a selfcontained ADO.Net Provider.

As for the data access layer lib, if you want some abstraction over ADO.Net:

All those work well starting with framework 2.0 and up.

Basically, you choose (and there is a lot of choices)

RHeitzmann
+5  A: 

For a lightweight ORM that performs well and only requires a single assembly why not try out Lightspeed from Mindscape. It's not open-source, however source is available and it's reasonably priced - the risk with most ORM's that aren't well adopted is of course quality and level of support, and there are very few other open source ORM's worth bothering with in the .Net space at the moment.

Because of your dislike of NHibernate's dependencies it sounds like you don't have a need for a logging framework or any of the castle project facets i.e. IoC, Monorail etc. Have you considered maybe just taking the bare minimum of NHibernate requirements (log4net and the Iesi collections I believe, and dynamic proxy from the castle project?) and running ILMerge over them to consolidate them into a single assembly - might take a bit of fiddling, but it's not too hard - or alternatively you could just pull the source code for each of these projects into a custom build of NHibernate you maintain for your organization that trims out the features not required by your project/organization - it's not as hard/akward as it sounds and I've done something along these lines for one project where we wanted to benefit of an ORM, but needed to reduce the size of the distributed files/installer.

Also - are you perhaps able to explain what you feel is too "heavy" about an Nhibernate based solution ... in my experience its a reasonably lightweight ORM framework compared to some.

Bittercoder
A: 

some of the alternatives:
- ActiveRecord - it uses nhibernate.dll in background, but configuration is done through attributes. It's like lite version of nhibernate
- Subsonic
- CoolStorage.NET - I used it a lot with small projects. Works well with number of dbs

Hrvoje
A: 

LINQ to SQL could be good alternative to "heave" ORM systems if you'll use it properly.

dimarzionist
LINQ to SQL only supports SQL Server - the poster stated that support for file-based DBs is critical.
Sean Carpenter
A: 

Here's a big list of alternatives, ones I'd recommend:

  • Coolstorage
  • SOODA
  • ODX
  • Lightspeed (free for 8 objects or less)

Those 4 are the lightest ones. Subsonic, ActiveRecord and others are aimed at large systems. They work fine on smaller systems but (atleast for ActiveRecord) come with a huge list of dependencies and overkill for a small system. I'd go with Lightspeed and say anything under 8 objects is a small system, and simply using NHibernate because it's widely adopted is good for scaling but in the short term makes no sense - and having a layer between the ORM and your consumers can work around that anyway.

Chris S
That link has expired, new location is http://shrinkrays.net/articles/a-look-at-net-object-relational-mapper-orms.aspx
Andrew M