Add ability to coalesce using a property instead of a constant

Description

Right now, NHibernate doesn't support things like this:

Instead, I have to write something as ridiculous as

which is, of course, not fun. See my StackOverflow question for details and a workaround.

I'm willing to submit a pull request along with a test, but there's a catch: as it is, I can't really just add another Coalesce() overload because it would have exactly the same signature. Of course, I could just give it another name, but what name would be good? IfNull(), like in the StackOverflow answer? IfNullThen()? OrElse()?

Or maybe there is another way to resolve the signature conflict? I thought about using an expression, like Coalesce(() => anotherAlias.AnotherProperty), but due to the lack of experience with C# I couldn't write expression processing code for that. And besides, it's too verbose.

Environment

None

Activity

Show:

Alex Zaytsev June 11, 2019 at 12:17 AM

Moved here.

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created July 31, 2016 at 5:15 AM
Updated June 11, 2019 at 12:17 AM
Resolved June 11, 2019 at 12:17 AM
Who's Looking?