Closed aradalvand closed 3 years ago
@AradAral thanks for reporting. But how would you want to represent the resulting query?
@hazzik Nevermind, I finally ended up writing a custom expression visitor to take care of that, it calls the MethodInfo.Decompile()
extension method internally and takes care of maintaining a max depth, as I thought perhaps this is a concern for DelegateDecompiler.
Thanks again, this is an awesome library.
Hi there. Thank you for developing this elegant tool.
My scenario is fairly simple: I have 2 domain classes
Book
andAuthor
, and 2 DTO classesBookDto
andAuthorDto
which are a subselection of those domain classes.I have 2 extension methods for converting these domain classes into their respective DTOs:
One that converts a
Book
into aBookDto
:One that converts an
Author
into anAuthorDto
Now, when I do the following or something similar:
I get a stack overflow exception. And the reason why, as you might've already noticed, is because
ToBookDto()
callsToAuthorDto()
andToAuthorDto()
callsToBookDto()
, and so on and so forth... and this process never stops.But of course, as you can see this scenario/requirement is not weird or uncommon. So, are there currently any ways to work around this? For example, setting a
MaxDepth
or something, etc.Thanks in advance.