2010-02-25 28 views
1

Castle ActiveRecord是否支持nHibernate支持的SQL公式?Castle ActiveRecord支持SQL公式吗?

例如在nHibernate中,我们可以做这样的事情。

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

这是Castle Active Record支持的吗?

回答

5

是的,[Property] attribute有一个公式属性。

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