Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many chained references for LINQ #110

Closed
avinashtauro-arctechinfo opened this issue Jul 12, 2022 · 2 comments
Closed

Too many chained references for LINQ #110

avinashtauro-arctechinfo opened this issue Jul 12, 2022 · 2 comments

Comments

@avinashtauro-arctechinfo

LINQ statements always show the ReSharper warning "Too many chained references. This might be violating the law of Demeter)
Is there an easy way to avoid this warning, other than to "Disable with comment".

var cassettesQuery = _db.Denominations
            .Include(d => d.Currency)
            .Where(d => ContainsValidDispensingNotes(d, _dispenseDenominationValues))
            .Select(d => CreateCassette(d));

This is a revisit of the issues mentioned below
hhariri#15
hhariri#20
#23

@MO2k4
Copy link
Owner

MO2k4 commented Jul 12, 2022

Another way would be to increase the value in the configuration. I can take another look at this and see if it is possible to know if the methods are chained via linq, but as already mentioned in the other issue, that could lead to other nasty side effects.

@avinashtauro-arctechinfo
Copy link
Author

I changed the config value from 3 to 4 and the warning on the above example went away.
Am working on my other LINQ statements to try and get it down to 4. And it is actually is making my LINQ more readable and modular.
Thanks for this extension.

@MO2k4 MO2k4 closed this as completed Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants