question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

problem with extended methods

See original GitHub issue

I have a base class which implements find, using <Model> as a generic and a unique url for each model, so a GET to /api/model1/find and /api/model2/find for example

each model data service extends this base service

however, if I @Cacheable() the find method in the base class, then the same data is returned from in-memory cache for any model.

ie if I first get users , then a subsequent call to find in the customer model also returns the list of users

The only way I see round this is to override each method in each model, and add a cache at that level but it seems a seriously nasty hack

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

0reactions
cyberbobjrcommented, Jul 28, 2020

you’re great ! many thanks for your job 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

A problem with extension methods - NDepend
We like extension methods. When named accordingly they can both make the caller code clearer, and isolate static methods from classes on which...
Read more >
Why I Don't Like C# Extension Methods - DaedTech
Extension methods are dangerous when developers implement business logic inside them. For example I was extending NopCommerce the other day and ...
Read more >
One problem with extension methods is that you cannot ...
One problem with extension methods is that you cannot statically express the idea that multiple classes implement the same extension methods.
Read more >
c# - Disadvantages of extension methods? - Stack Overflow
Extension methods are fun, but there are potential problems with them. For instance, what if you write an extension ...
Read more >
The sad state of extension methods in the JVM ecosystem
The sad state of extension methods in the JVM ecosystem · The problem · What we have in Java · In other languages...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found