Linq.NHibernate problem with OR statement
Date : March 29 2020, 07:55 AM
this one helps. Ok, here's the solution! I'm using PredicateBuilder from this website: PredicateBuildervar expr = PredicateBuilder.False<Audit>();
foreach(CodedValue codedValue in auditEventIds)
{
CodedValue cv = codedValue;
expr = expr.Or(a => (a.EventId.Code == cv.Code) && (a.EventId.CodeSystemName == cv.CodeSystemName));
}
itemQuery = itemQuery.Where(expr);
|
How to check query statement in Linq to NHibernate?
Tag : .net , By : obijywk
Date : March 29 2020, 07:55 AM
like below fixes the issue You could either configure log4net or use an SQL Profiler to see what's actually sent to the database. Yet another option (if you are willing to spend a few bucks) is to checkout Ayende's excellent tool.
|
SQL IN statement in Linq for NHibernate
Tag : linq , By : Grace Jones
Date : March 29 2020, 07:55 AM
Any of those help The NHibernate LINQ provider is limited when it comes to the IN clause. It seems to only work with collections where T is a simple type, e.g. List or List. This works in NHibernate 3.1 (not tested in earlier versions):var asd = ResultIdsAndSymbols.ToLookup(x => x.Symbol, y => y.ResultID);
foreach (var qwe in asd)
{
List<int> list = qwe.ToList();
var Numbers = (from t in Session.Query<TableName>()
where list.Contains(t.ResultID)
select t.Number).ToList();
}
|
Case statement in NHibernate / EF Linq
Date : March 29 2020, 07:55 AM
I wish did fix the issue. What will be the equivalent of following SQL statement in Linq? I'm specifically looking on how to replace CASE statements in Linq expression. , This should help you out var query = from l in context.info_log
from a in context.application_info
where l.app_id == a.app_id
where l.level_nm == "ERROR" || l.level_nm == "FATAL"
group l by new { a.app_id, a.app_nm } into lg
select new
{
Id = lg.Key.app_id,
Name = lg.Key.app_nm,
Error = lg.Where(x => x.level_nm == "ERROR").Count(),
Fatal = lg.Where(x => x.level_nm == "FATAL").Count(),
};
|
How to set timeout for NHibernate LINQ statement
Date : March 29 2020, 07:55 AM
|