views:

464

answers:

2

Coming from the Ruby community and approching IronRuby for desktop application development, I have little interest in using a .NET based ORM such as Linq. I want to use the ruby-way of data access that I've come to love from products such as ActiveRecord, DataMapper, and Sequel.

After much searching I ran into a brick wall trying to get ActiveRecord working on IronRuby for any database other than MS SQL. I would really like to use an embedded database like SQLite, HSQLDB, H2 etc.

Has anyone got a Ruby based ORM working in IronRuby with an embedded DB. What was the database, the ORM? Can you share some tips? Should I learn Linq or .NET based ORM?

A: 

In the Data Access chapter of my book, I have a sample where I use MySQL database via IronRuby.

What I did was to use MySQL's .Net assembly from IronRuby. Worked perfectly. This chapter should be added to the book Rough Cuts chapters soon, so you'll be able to take a look at the actual code.

Check the IronRuby Unleashed page on Safari Books to get access to the book Rough Cuts chapters.

Shay Friedman
Did you show how to use any Ruby based ORMs such as ActiveRecord, Sequel or DataMapper?
jrhicks
No, but you might want to check out this page which talks about using Ruby on Rails with IronRuby and about using ActiveRecord - http://www.ironruby.net/Documentation/Real_Ruby_Applications/Rails
Shay Friedman
Yes but the ironruby.net link is only for the MSSQL adapter
Philippe Monnet
Tell me what are you looking for and I'll try to look into it. I'll write a post about it in the next few days after I'm done.
Shay Friedman
I'm looking to use a Ruby based ORM such as Active Record, Sequel, or DataMapper with an embedded database such as SQLite, HSQLDB, or H2 etc.
jrhicks
+2  A: 

Hi

I'm about to blog a wrapper around the lightspeed OR/M I think it's all in all about 3-400 lines of ruby and it would allow you to use active record style finders but in the context of a .NET OR/M

http://www.mindscape.co.nz/products/lightspeed/

The idea behind lightspeed is very close to the idea behind datamapper. You can use anything from the System.Data namespace in IronRuby but that would entail making your own mapping to your objects and translating update/delete queries to DbCommands and managing the connections yourself.

I'm looking at improving dbi for sql server later today. I'll look at the sqlite one when I've got a higher test coverage. Anyway implementing a dbi provider for sqlite that uses .NET won't take very long and you're more than welcome to email/IM me if you want to do it.

But at this point the state of IronRuby is such that if you want something to work and it doesn't yet you have to do it yourself.

Casual Jim
I look forward to your blog post. Thanks.
jrhicks