Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Nhibernate中将hbm.xml映射转换为Confirmit代码映射_C#_Nhibernate_Nhibernate Mapping - Fatal编程技术网

C# 在Nhibernate中将hbm.xml映射转换为Confirmit代码映射

C# 在Nhibernate中将hbm.xml映射转换为Confirmit代码映射,c#,nhibernate,nhibernate-mapping,C#,Nhibernate,Nhibernate Mapping,目前,我正在将hbm.xml文件转换为代码映射(Confirmist)。我可以转换所有内容,但我不确定如何转换manyToMany属性中的where子句 <set inverse="true" name="Skills" table="UserPrivileges" mutable="true"> <key> <column name="UserID" /> </key>

目前,我正在将hbm.xml文件转换为代码映射(Confirmist)。我可以转换所有内容,但我不确定如何转换manyToMany属性中的where子句

<set inverse="true" name="Skills" table="UserPrivileges" mutable="true">
            <key>
                <column name="UserID" />
            </key>
            <many-to-many class="School.Campaign.Domain.Skill, School.Campaign.Domain" where="PrivilegeType = 'Skill'">
                <column name="PrivilegeID" />
            </many-to-many>
        </set>

但这将不起作用,因为缺少where子句和类类型。任何人都可以帮助我。

您应该可以调用
。其中
位于
的内部。许多
映射选项:

Set(x => x.Skills, m =>
{
    m.Schema("dbo");
    m.Table("UserPrivileges");
    m.Key(k => k.Column("UserID"));
    m.Cascade(Cascade.None);
}, col => col.ManyToMany(m =>
{
    m.Columns(x => x.Name("PrivilegeID"));
    m.Where("PrivilegeType = 'Skill'"); // <-----
}));
Set(x=>x.Skills,m=>
{
m、 模式(“dbo”);
m、 表(“用户权限”);
m、 键(k=>k.Column(“UserID”);
m、 Cascade(Cascade.None);
},col=>col.ManyToMany(m=>
{
m、 列(x=>x.Name(“PrivilegeID”);

m、 Where(“PrivilegeType='Skill'”;//没有人给我添加Where的选项clause@MoizKachwala:我不知道你的意思。在上面的映射中有一个
m.Where
调用。。。。
Set(x => x.Skills, m =>
{
    m.Schema("dbo");
    m.Table("UserPrivileges");
    m.Key(k => k.Column("UserID"));
    m.Cascade(Cascade.None);
}, col => col.ManyToMany(m =>
{
    m.Columns(x => x.Name("PrivilegeID"));
    m.Where("PrivilegeType = 'Skill'"); // <-----
}));