views:

28

answers:

1

Does Castle ActiveRecord supports SQL formula as supported by nHibernate?

E.g. In nHibernate we can do something like this.

<property name="CountOfPosts"
    formula="(select count(*) from Posts where Posts.Id = Id)"/>

Is this supported in Castle Active Record?

+4  A: 

Yup, the [Property] attribute has a Formula property.

[Property(Formula = "(select count(*) from Posts where Posts.Id = Id)")]
public int CountOfPosts {get;set;}
Mauricio Scheffer