0

嗨如何对同一张表使用查询(加入)...示例

        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");

        }

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

4

1 回答 1

3

尝试使用别名

EnderecoProspect additionalProspect = null;

query
   .JoinQueryOver<EndercoProspect>(x => x.Endercos, () => additionalProspect)...
于 2011-04-20T21:44:10.600 回答