繁体   English   中英

NHBERNATE QUERYOVER

[英]NHIBERNATE QUERYOVER

您好如何对同一张表使用queryover(Join)...示例

        if (!string.IsNullOrEmpty(ufResidencia))
        {
            EnderecoProspect endProspectRes =null;
            TipoEndereco tipoEndProspectRes = null;

            query
                .JoinQueryOver<EnderecoProspect>(x => x.Enderecos, () => endProspectRes)
                    .And(() => endProspectRes.Uf == ufResidencia)
                        .JoinQueryOver<TipoEndereco>(x => x.TipoEndereco, () => tipoEndProspectRes)
                            .And(() => tipoEndProspectRes.Descricao != "Fazenda");
        }

        if (!string.IsNullOrEmpty(ufFazenda))
        {
            EnderecoProspect endProspectFaz = null;
            TipoEndereco tipoEndProspectFaz = null;

            query
                .JoinQueryOver<EnderecoProspect>(x => x.Enderecos, () => endProspectFaz)
                    .And(() => endProspectFaz.Uf == ufFazenda)
                        .JoinQueryOver<TipoEndereco>(x => x.TipoEndereco, () => tipoEndProspectFaz)
                            .And(() => tipoEndProspectFaz.Descricao == "Fazenda");

        }

当我尝试运行时,我收到消息,指出路径已重复。

尝试使用别名

EnderecoProspect additionalProspect = null;

query
   .JoinQueryOver<EndercoProspect>(x => x.Endercos, () => additionalProspect)...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM