problem with extended methods
See original GitHub issueI 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:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it is. https://github.com/angelnikolov/ngx-cacheable/blob/dc1c2cc90cbd09f9209a82632a161ce49fa12466/common/index.ts#L8
you’re great ! many thanks for your job 😄