Closed alexy4744 closed 1 month ago
Thanks for the suggestion, @alexy4744. How would I know where to stop decompiling methods?
If you do not want to pollute your model with the attributes, you should be able to register computed in mapping by code or by convention.
I'm not familiar with the inner workings and the reflection behind it, but I was thinking maybe something like .Computed(recursive: true)
, which will recursively decompile any descendant methods.
So in my example, x.Status.Computed(recursive: true)
will be decompiled and it sees that it uses IsApproved
, IsRejected
, IsSubmitted
properties, so it will call .Computed(recursive: true)
on those properties also. Not sure if this is possible?
If you do not want to pollute your model with the attributes, you should be able to register computed in mapping by code or by convention.
Is this already possible today with the package? I can't find any documentation on it. Thanks!
Is this already possible today with the package?
Yes
on those properties also. Not sure if this is possible?
How would it know that it should not decompile SubmittedAtUtc
?
Other option, if you do not use EF - you can override Configuration.ShouldDecompile
method:
And then register your custom configuration like following:
var configuration = new MyCustomConfiguration();
Configuration.Configure(configuration);
This works even better and makes more sense than what I was suggesting. Thanks!
Glad I could help. And thanks for the contribution. Really appreciate it.
I have the following class:
I would like to query it using EF Core like so:
But this throws a LINQ translation error because
.Computed()
is not applied to the dependent properties (IsApproved
,IsRejected
,IsSubmitted
). I could solve this by adding[Computed]
to the properties in my class, but I don't want to pollute my domain model with it.Will this be supported in the future? If not, is it possible to write an extension method so that
.Computed()
will also be applied to the dependent properties?Thanks!