它与IndexedEmbedded有何不同?
附注:关于NHibernate.Search的最好的信息来源是什么?
发布于 2010-03-03 07:18:10
ContainedInAttribute与IndexedEmbeddedAttribute一起使用。ContainedInAttribute被用作一种标记,它指向使用和IndexedEmbeddedAttribute的类。这将告诉NHibernate.Search,当您更新该类时,您希望更新父类的全文索引。当您更新所属类的子类,并且希望所有者的索引也更新时,这是很好的。
下面是一个如何使用它的示例。
[Indexed]
class Parent
{
[IndexedEmbeded]
public Child SomeChild { get; set; }
}
class Child
{
[ContainedIn]
public Parent MyParent { get; set; }
}注意:如果您指向未使用IndexEmbeded属性的所属父级,则ContainedIn属性是无用的。
文档信息来自hibernate search,但这里的大多数内容也适用于NHibernate.Search。
http://docs.jboss.org/hibernate/stable/search/reference/en/html/
或
http://docs.jboss.org/hibernate/stable/search/reference/en/html_single/
https://stackoverflow.com/questions/2352381
复制相似问题