我需要知道nhibernate映射中映射包的Key列名称。
但是我没有在NHibernate.Cfg.Configuration.CollectionMappings
和Collection
类型的每个项目中找到任何东西。
例如,我们具有以下配置:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Farayan.Web.Portal" namespace="Farayan.Web.Portal.EntityLayer" >
<class name="ModuleEntity" table="Portal_ModulesTable">
<id name="Id">
<generator class="identity"/>
</id>
<version name="Version"/>
<bag name="Properties" table="Portal_ModulePropertiesTable" lazy="false" fetch="subselect">
*<key column="Module"/>*
<composite-element class="Farayan.Web.Portal.PropertyValue">
<property name="Name"/>
<property name="Value"/>
<property name="Culture"/>
</composite-element>
</bag>
</class>
</hibernate-mapping>
我想找到列Module
的名称(在cfg中用*包围)
但是在下面的代码中:
foreach (Collection collectionMapping in configuration.CollectionMappings) {
//collectionMapping.Key is null!
}
collectionMapping.Key为空