开发者

NHibernate querying on any-associations meta-value

开发者 https://www.devze.com 2022-12-23 00:13 出处:网络
I have a collection of entities with an any-association, like this: public class CreatedLog { public string Message { get; set; }

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

精彩评论

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