C# 分部类中属性的级联值

C# 分部类中属性的级联值,c#,nhibernate,nhibernate-cascade,C#,Nhibernate,Nhibernate Cascade,我有一个映射和POCO,如下所示。问题是保存此对象时,tbFNamesFeature未更新(而tblffeature未更新) 我尝试了不同的级联值,但没有效果,所以我不得不说我没有得到一些东西。(请参见xml中的???。 我做错了什么 tbFNamesFeature有两列: FNamesId(主键,整数,非空) FeatureId(主键,整数,非空) Feature.part.cs public partial class Feature : System.IComparable {

我有一个映射和POCO,如下所示。问题是保存此对象时,
tbFNamesFeature
未更新(而
tblffeature
未更新) 我尝试了不同的
级联
值,但没有效果,所以我不得不说我没有得到一些东西。(请参见xml中的???。
我做错了什么

tbFNamesFeature
有两列:

FNamesId(主键,整数,非空)
FeatureId(主键,整数,非空)

Feature.part.cs

public partial class Feature : System.IComparable
{
        private System.Collections.Generic.IList<FName> fnames;

        public virtual System.Collections.Generic.IList<FName> FNames
        {
            get
            {
                if (this.fnames == null)
                {
                    this.fnames = new System.Collections.Generic.List<FName>();
                }
                return this.fnames;
            }
            set {
                this.fnames = value;
            }
        }
 }
公共部分类功能:System.IComparable
{
private System.Collections.Generic.IList fnames;
公共虚拟系统.Collections.Generic.IList FNames
{
收到
{
if(this.fnames==null)
{
this.fnames=new System.Collections.Generic.List();
}
返回此.fnames;
}
设置{
this.fnames=值;
}
}
}

编辑以反映讨论:由于tblFNamesFeature是一个多对多表,需要使用reverse=“false”设置映射,以指示关系的另一端不负责保存集合


cascade=“all”也需要设置(包括保存、更新和删除)。

您是说我需要
tbFNamesFeature
的映射吗?是的。您需要模型中每个实体/表的映射。唯一的例外是纯多对多表。事实上,对不起,我刚刚重读了你的帖子。tbFNamesFeature应该是多对多表吗?如果是,它链接到什么?是
tblFNamesFeature
是多对多。有一个表,
tblFNames
,它的主键是
FNamesId
tblFNamesFeature
)。我有一个“tblFNames”的映射文件。我认为inverse=“true”表示关系的另一端负责保存。请尝试反向=“false”。
public partial class Feature : System.IComparable
{
        protected int id;
        protected string description;

        public virtual int Id
        {
            get { return this.id; }
            set { this.id = value; }
        }

        public virtual string Description
        {
            get { return this.description; }
            set { this.description = value; }
        }
}
public partial class Feature : System.IComparable
{
        private System.Collections.Generic.IList<FName> fnames;

        public virtual System.Collections.Generic.IList<FName> FNames
        {
            get
            {
                if (this.fnames == null)
                {
                    this.fnames = new System.Collections.Generic.List<FName>();
                }
                return this.fnames;
            }
            set {
                this.fnames = value;
            }
        }
 }