well castles is built right on top of nhiberate, added dependency with
added configuration
subsonic & castle both use a heavy object syntax
<code>
Query qry =new Query("Products").BETWEEN_AND("DateExpires",DateTime.Now,
DateTime.Now.AddDays(30);
qry.OrderBy = OrderBy.Asc(Product.Columns.ProductName);
</code>
vs
<code>
Entity object = Entity.Find(Conditions => new {"DateExpires > {0} AND
DateExpires < {1}", DateTime.Now, DateTime.Now.AddDays(30) }, Order =>
"ProductName DESC");
</code>
and i could be wrong, but these are strongly typed objects, in rails,
its more of a decorated object, to which you do not need reflection in
order to access properties. so lets say you use a grid view and its
update event.
<code>
private void Grid_UpdatingRow(GridViewRowUpdateArgs e) {
Entity obj = GetCurrentEntity();
obj.DateExpires = e.NewValues["DateExpires"];
obj.ProductName = e.NewValues["DateExpires"];
/// keep going....
obj.Save();
}
// or
private void Grid_UpdatingRow(GridViewRowUpdateArgs e) {
Entity obj = GetCurrentEntity();
foreach(string key in e.NewValues.Keys)// performance hit
obj.GetType.GetProperty(key).SetValue(obj, e.NewValues[key],
null);
obj.Save();
}
</code>
// using a decorated object
<code>
private void Grid_UpdatingRow(GridViewRowUpdateArgs e) {
Entity obj = GetCurrentEntity();
foreach(string key in e.NewValues.Keys)
obj[key] = e.NewValues[key]; // ideal
obj.Save();
}
</code>
its pretty much a matter of opinion. like with the new rails mvc, i
could grab the dictionary from the open and do something like
Enitity.Find(2).Merge(Request.Form).Save();
and even though subsonic is working on it, no migrations yet. I've
already gotten the concept of a migration working for sql.
Ivan Porto Carrero wrote:
> The guy that wrote inflector.net created an orm called LightSpeed which
> is
> pretty much ActiveRecord from rails, but with some other nice things put
> in
> like the ability to choose a KeyTable identity strategy or use guids as
> pk's. It also uses IdentityMap internally etc.
> That's the ORM I mostly tend to use these days. I may be slightly
> biased
> because these guys are my friends :)
>
> Out of curiosity what is it that puts you off from Castle's activerecord
> or
> Subsonic? And what is it you like so much about the Rails ActiveRecord
> implementation?
>
>
> On Mon, Mar 10, 2008 at 9:54 AM, Michael Herndon <[EMAIL PROTECTED]>
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core