Relative Content

Tag Archive for interfaces

Why should IQueryProvider implementations throw NotSupportedExceptions?

Searching the web, we can find plentiful examples of various ORMs (nHibernate, EF, LinqToSql, etc.) that implement but don’t actually support the full IQueryable<T> interface, throwing NotSupportedExceptions when they encounter something they don’t like, such as LinqToSql and SkipWhile. My question is this: why do ORM providers opt to throw a NotSupportedException instead of letting certain query operators (that do not translate well or at all to the target data source) trip a query execution and then let Linq to objects handle the rest?

Why should IQueryProvider implementations throw NotSupportedExceptions?

Searching the web, we can find plentiful examples of various ORMs (nHibernate, EF, LinqToSql, etc.) that implement but don’t actually support the full IQueryable<T> interface, throwing NotSupportedExceptions when they encounter something they don’t like, such as LinqToSql and SkipWhile. My question is this: why do ORM providers opt to throw a NotSupportedException instead of letting certain query operators (that do not translate well or at all to the target data source) trip a query execution and then let Linq to objects handle the rest?