2010-02-28 57 views

回答

1
  1. 回答

的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属性无用。

  • 回答
  • 文件信息是从休眠搜索,但这里的大多数事情适用于NHibernate.Search为好。

    http://docs.jboss.org/hibernate/stable/search/reference/en/html/

    http://docs.jboss.org/hibernate/stable/search/reference/en/html_single/