[Ironruby-core] requiring .NET assemblies

Ivan Porto Carrero ivan at flanders.co.nz
Mon Feb 18 15:30:57 EST 2008


I ran into a pretty weird issue, I tried to use some of the .NET ORM's with
I haven't investigated with the debugger turned on yet but here's what I

I tried this with ActiveRecord from Castle, SubSonic and LightSpeed.
Linq2Sql doesn't have a problem.

What the first 3 ORM's have in common is that I can use the types in the
actual ORM library. All of those ORM's require you to have a generic base
If I include other types in the assembly (non generic base classes) then I
can just use those classes.
When I create a type with a generic base class that is defined in the same
assembly I can use that class in IronRuby

For SubSonic a Customer class could look like:

*public class Customer : ActiveRecord<Customer>{
  // model code here

The output from the console session that shows the behavior. I tried a lot
of different approaches but it always boils down to the same error.

*IronRuby 0.1 on .NET 2.0.50727.1434
Copyright (c) Microsoft Corporation. All rights reserved.

Note that local variables do not work today in the console.
As a workaround, use globals instead (eg $x = 42 instead of x = 42).

>>> require 'mscorlib'
=> true
>>> require Dir.getwd + '/SubSonic.dll'
=> true
>>> require Dir.getwd + '/DataAccess.SubSonic.dll'
=> true
>>> include DataAccess::SubSonic
=> Object
>>> Customer.new
IronRuby.Libraries:0:in `ConstantMissing': uninitialized constant
Object::Customer (NameError)
        from :0:in `main'
        from :0:in `##16'
>>> exit*

Is this a bug or is it a case of me missing something?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080219/1efe70ca/attachment.html 

More information about the Ironruby-core mailing list