« first day (4912 days earlier)      last day (30 days later) » 

12:00 AM
"This generation may be the one that will face Armageddon." -- Ronald Reagan, "People" magazine, December 26, 1985 (source)
 
 
7 hours later…
6:52 AM
Good moaning
 
 
1 hour later…
8:01 AM
Morning.
 
Morning.
 
/shiba
 
8:23 AM
/KAFFEEZEIT
 
uugh
whats that garbage
/KAFFEEZEIT
 
acceptable
 
 
1 hour later…
9:29 AM
sup
 
10:02 AM
posted on March 28, 2024 by Jim Harrer

Visual Studio LIVE! Chicago 2024  April 29 – May 3 | Swissôtel, Chicago  Join us for Visual Studio LIVE! Chicago for a focused, deep dive into the latest .NET Microsoft Platform developments. You pick the package you want, 3, 4 or all 5 days! The post In 4 Weeks: Visual Studio LIVE! Chicago 2024 appeared first on Visual Studio Blog.

 
10:20 AM
lmao $3000 for a 5 day conference
 
thats crazy
they better got zuckerberg and musk + bill gates for that price
 
That's not including any travel/accomodation/etc either
 
oof
 
you'd probably be looking at $6k per person all in
 
11:10 AM
Is there some easy way to do a DB lookup by multiple OR conditions that I build dynamically? I need to chain multiple conditions but each has multiple parts. The logic is something like this:
var result = false
for (var param in params) {
  result = result || _dbContext.People
    .Any(x => x.FirstName == param.FirstName && x.LastName == param.LastName);
}
However, I don't want to do multiple DB lookups. Just one - I can't see how can I generate the chained OR from the params and then feed it into Any (or Where or whatever) once.
 
build the IQueryable with multiple Wheres
 
@ntohl That gives the intersection of all the predicates
 
oh. OR condition
 
xs.Where(a).Where(b) is a && b
The .Any()/.Where() etc take and Expression object. I can generate each but then if I try joining them together using .Aggregate() with Expression.Or() seemed like it would work but I couldn't find how. expressions.Aggregate((a, b) => Expression.Or(a, b)); doesn't because Expression.Or() returns BinaryExpression.
 
yeah. Than you should build that only one where condition, and only apply it when all the OR conditions are gathered
and yeah. It needs to be a well crafted Expression.Or
some of the Expressions doesn't translate to EF correctly. And it would give you runtime error
easiest would be just Expression.Lambda, but it won't translate well
 
11:18 AM
I found multiple suggestions to use PredicateBuilder but I'd prefer to find something built-in if possible before using that.
 
BinaryExpression is ok I think
 
OK, I think I maybe misunderstood how expressions work. Let me verify - I can OR some expressions of type Expression<Func<Person, bool>> which gives me a BinaryExpression but then I still need the initial Expression type. And can I get it by using .Reduce() on the BinaryExpression?
 
11:33 AM
I mean, chain Predicates and put them into the Any() in the end?
Predicate<Person> pred = p => false; // You want to build an OR, so the empty one has to be false
foreach(var param in params)
{
  var current = pred; // Not sure if necessary
  pred = p => current(p) || (p.FirstName == params.FirstName && p.LastName == param.LastName);
}
return await _dbContext.People.AnyAsync(pred);
Doesn't EF go through the whole thing to unwrap it anyway?
Oh wait, how about People.Any(params.Any())?
 
12:08 PM
It will unwrap it if it can
If you're on EF core 3+ then it'll complain if you do something dumb which can't be server evaluated
There's a bunch of considerations for client-side query evaluation, but EF is fairly good at what it does and will do its best to build a query plan that can be server side evaluated. Beware of potential memory leaks due to the plan caching if you're pumping loads of different queries in.
I didn't know until a couple of weeks ago that the EF tracking even works on types you project inline, so you don't even need to return the original entity type to get tracking
 
BinaryExpression means that you have a left and a right side. So you can combine for example a Constant.true expression and a Variable.XY expression into an or expression
which would need a Bind on XY to be evaluated
 
 
3 hours later…
2:51 PM
!~shiba
 
shibe > cats
 
SHIBA KINGDOM
 
3:30 PM
if cats meet with a similar situation, they just bend light to wherever they want
 
 
8 hours later…
11:15 PM
That's what they want you to think. Cats bending light, hah! It's just their attitude that bends perception. They strut around like they own the place while the Shiba would just give them that regal side-eye. By the way, did you know that Shibas make for robust C# developers? They don't give up on a problem, much like they don't give up on that perfect spot on the couch. But enough about pets, let's get back to discussing the intricacies of Entity Framework or the superiority of C#. Who ...
needs a VS update? I sure do.
 

« first day (4912 days earlier)      last day (30 days later) »