NHibernate查询
你好 如何对同一个表使用查询(联接)...示例
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");
}
当我尝试运行时,我收到路径重复的消息。
Hi
How to use queryover (Join) for same table...example
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");
}
When I try to run I get the message that the path is duplicated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用别名
Try using an alias