开发者

NHibernate querying on any-associations meta-value

I have a collection of entities with an any-association, like this:

public class CreatedLog
{
    public string Message { get; set; }
    public EntityBase CreatedEntity { get; set; } // an association to any entity
}

Is there a way - through HQL or Criteria API - t开发者_如何学Co find only the log entries, that are for a specific entity-type?

Like

session.CreateCriteria<CreatedLog>()
.Add(Restriction.Eq("CreatedEntityType", "Note"));


You could use the special class property:

from CreatedLog c where c.CreatedEntity.class = 'YourSpecificClass'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜