Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Using ruby's activerecord in C#/.NET
6 Posts
Using ruby's activerecord in C#/.NET

The one thing that I really liked about ruby is activerecord. Is there a way for me to use it in my c# projects so that I can only have a one business layer to use(which is activerecord) on my web apps and desktop apps?

Hey Reymon,

There is an MVC framework for ASP.NET called... ASP.NET MVC created by Scott Guthrie and his team, you should give it a try because for more and more companies, it's the standard framework (replacing the old codebehind way of designing your app).

The other answer didn't really cover the same thing - ASP.NET MVC offers an MVC framework that's miles better than the previous ASP.NET framework (IMHO), but it doesn't cover ActiveRecord - a lot of the documentation you'll find talks about using a DBML file and LINQ for data access. For actually getting ActiveRecord implementations within .NET, there's the Castle MonoRail project, which includes Castle ActiveRecord. Alternatively there's the SubSonic project, which also has an ActiveRecord implementation. Both work. Both have the standard limitations (don't try using an object model to add a million records, use the native database bulk import routines, etc). SubSonic probably has more traction of late, although the Castle ActiveRecord comes as part of its own MVC implementation which is also worth a look.

Neither are quite the same as Ruby's way of doing things, because you're defining an object model and letting the system update the database structure, rather than defining migrations, so it doesn't necessarily simplify migration from one revision to another as much as you might expect coming from using ActiveRecord in a Ruby environment, but on the plus side you're defining classes in C#/VB.NET, not using a Domain-Specific Language.

I "use activerecord's migrator":http://stevehodgkiss.com/2009/11/14/using-activerecord-migrator-standalone-with-sqlite-and-sqlserver-on-windows.html in .NET projects, and nhibernate w/fluent nhibernate for data access.

A few years ago I've been presented to this project: http://castleproject.org/castle/projects.html It tries to give same kind of tools in C#, it was before ASP.NET MVC but I think is still relevant! Good Luck!

What I really mean is I want to use ruby activerecord library in my c# apps. Is it possible? I've heard of ironruby, will I be able to use it?

6 Posts
Login to add your message