2010-02-28 33 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/