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'
精彩评论