Nhibernate 翻译 1=0
Nhibernate translates 1=0
Nhibernate 中这个 1=0 的原因是什么
SELECT
this_.LoanId as LoanId89_0_,
this_.BranchId as BranchId89_0_,
FROM
dbo.Loan this_
WHERE
this_.LoanId in (
SELECT
this_0_.LoanId as y0_
FROM
dbo.MyEntity this_0_
WHERE
this_0_.MyEntityId = 795
)
and 1=0
ORDER BY
this_.LoanNumber asc;
我正在尝试检索一些记录,Nhibernate 在 AND 子句中将其转换为 1=0
Loan.cs
public Loan() : base()
{
this.Loanid = null; //int32 type
this.Branchid = null; //int32 type
}
这是贷款 Class 的小版本的样子。
由于子查询,它执行 WHERE。它选择 ID 是因为 GetIQueryOverForLoanSearch.It 只是使用投影和 AliasToBean(SearchResult) 选择所有列。我只是无法理解或弄清楚 1=0 是从哪里来的?
还有一些子查询正在进行。这只是一个非常小的版本
var subQuery = QueryOver.Of<MyEntity>().Where(x => x.MyEntityId == entityId).Select(x => x.LoanId);
var loans = GetIQueryOverForLoanSearch(manager.Session.GetISession(), false).WithSubquery.WhereProperty(x => x.Id).In(subQuery).OrderBy(x => x.LoanNumber).Asc.List<SearchResult>();
private static IQueryOver<Loan, Loan> GetIQueryOverForLoanSearch(ISession session, bool setMaxSearchResults = true)
{
SearchResult lr = null;
Loan l = null;
var queryOver = session.QueryOver(() => l).Select(Projections.Property(() => l.Id).WithAlias(() => lr.LoanId)).TransformUsing(Transformers.AliasToBean<SearchResult>());
return queryOver;
}
我应该查看数据结构还是标准?
这是完整的代码吗?因为当存在空 Restrictions.Disjunction
时,我看到悬空的 1 = 0
,但我在那里没有看到它们。
Nhibernate 中这个 1=0 的原因是什么
SELECT
this_.LoanId as LoanId89_0_,
this_.BranchId as BranchId89_0_,
FROM
dbo.Loan this_
WHERE
this_.LoanId in (
SELECT
this_0_.LoanId as y0_
FROM
dbo.MyEntity this_0_
WHERE
this_0_.MyEntityId = 795
)
and 1=0
ORDER BY
this_.LoanNumber asc;
我正在尝试检索一些记录,Nhibernate 在 AND 子句中将其转换为 1=0
Loan.cs
public Loan() : base()
{
this.Loanid = null; //int32 type
this.Branchid = null; //int32 type
}
这是贷款 Class 的小版本的样子。 由于子查询,它执行 WHERE。它选择 ID 是因为 GetIQueryOverForLoanSearch.It 只是使用投影和 AliasToBean(SearchResult) 选择所有列。我只是无法理解或弄清楚 1=0 是从哪里来的? 还有一些子查询正在进行。这只是一个非常小的版本
var subQuery = QueryOver.Of<MyEntity>().Where(x => x.MyEntityId == entityId).Select(x => x.LoanId);
var loans = GetIQueryOverForLoanSearch(manager.Session.GetISession(), false).WithSubquery.WhereProperty(x => x.Id).In(subQuery).OrderBy(x => x.LoanNumber).Asc.List<SearchResult>();
private static IQueryOver<Loan, Loan> GetIQueryOverForLoanSearch(ISession session, bool setMaxSearchResults = true)
{
SearchResult lr = null;
Loan l = null;
var queryOver = session.QueryOver(() => l).Select(Projections.Property(() => l.Id).WithAlias(() => lr.LoanId)).TransformUsing(Transformers.AliasToBean<SearchResult>());
return queryOver;
}
我应该查看数据结构还是标准?
这是完整的代码吗?因为当存在空 Restrictions.Disjunction
时,我看到悬空的 1 = 0
,但我在那里没有看到它们。