3 ms·
This is evil, and unnecessary. If you don't want to expose an IQueryable for whatever reason, and you don't want to write separate methods for each query, use s
by stuffihavemade 15y ago
This is evil, and unnecessary. If you don't want to expose an IQueryable for whatever reason, and you don't want to write separate methods for each query, use static reflection. But please, don't abuse dynamic like this.
- ppog 15y agoIt may be unnecessary, but I don't think it's an abuse. As I understand it, frameworks like Rails use idioms like this quite extensively, and enabling code written in static languages to receive dynamic member calls is pretty much the point of having DynamicObject in the .NET framework. That said, it's probably more relevant if you need to call the repository from DLR languages. And in that case you might as well choose to write the repository class in the DLR language, which will presumably have native support for dynamic method resolution.