08:26
Oh. There is a WPF chat room. I just asked the following question in the C# room, I guess it should have been posted here, sorry for the double post.
So: I was playing around in my mind with the idea of creating computed viewmodel properties by means of linq expressions so that by parsing the expression tree I can discover the dependencies instead of having to add calls to cumbersome and error-prone ObservesProperty(). Does anyone have any experience with this? Is there any product out there that already does this?
5 hours later…
13:32
I'm not aware of any library that does exactly what you describe, no. I think it would be at least interesting to see!
But I will say there have been a variety of ways to get around the boilerplate of writing e.g. INPC calls by hand; often you wind up paying a performance cost, since C# didn't have compile-time source generation facilities until fairly recently. With source generation you can modify the code at compile time to have minimal-cost change notification, otherwise you have to pay the cost somewhere at runtime to inspect the VM
But I will say there have been a variety of ways to get around the boilerplate of writing e.g. INPC calls by hand; often you wind up paying a performance cost, since C# didn't have compile-time source generation facilities until fairly recently. With source generation you can modify the code at compile time to have minimal-cost change notification, otherwise you have to pay the cost somewhere at runtime to inspect the VM
14:20
@MikeNakis There's an IL rewriter out there called Fody that has a plugin for injection of INPC. Might be what you're looking for. github.com/Fody/PropertyChanged
1 hour later…
16:30
@Zarenor source generation, even runtime MSIL generation, is a bit like magic, and I am in favor of reducing magic. I use magic for things that cannot be done otherwise, for example generating proxy classes. Parsing the expression tree would allow a magic-free solution, and I believe there is inherent benefit in that.
True, it would not perform as well as code generation, but then code generation could be seen as an optimization on top of a base mechanism that would do the job using conventional means. (Insofar as Expression Trees can be considered conventional.)
I would be grateful if you could point me to anything that does even remotely what I am looking for, (for example that database library offering you spoke of,) because I'd like to get some ideas from existing code before I start getting dirty with it.
I do not have experience with linq used for querying databases, but if they allow creating a WHERE clause where the expression terms are mapped to database fields, then they must have done most of what I want to do.
3 hours later…
i went through it trying to my own LINQ provider back in the day that could speak to ODATA but somebody else beat me to it and i never went too far in (i also dont remember expression parsing at this unfortunately, but EF source was very helpful to decipher expression magic under the hood)
@Alex This is a pretty old message, I think it needs clarification: not using a
Startup
class is optional, we use it in our .NET 6 microservices « first day (3798 days earlier) ← previous day next day → last day (351 days later) »