Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: Make DbExpressionBuilder.In internal [1327]

$
0
0
Because of the following issue we'll just make this internal for EF6

DbExpressionBuilder.In returns DbExpression which is unintuitive since all other DbExpressionBuilder methods return an expression of the specific type and not of the DbExpression base type. The reason why we return DbExpression is that in case of an empty list we turn the DbInExpression just to DbConstantExpression(false). From the technical point of view it is fine but from the user's perspective it has some drawbacks:
- you always need to upcast the returned expression to DbInExpression if you want to use it in a non-generic way (i.e. you want to access any of the properties defined on the DbInExpression type)
- you need to be aware that the expression you get does not have to be the DbInExpression (so you can't blindly upcast it)
Comments: With the fix DbExpressionBuilder.In always returns a DbInExpression. Empty expression list within the In expression is handled by the SQL generator, in which case it generates SQL similar to a false constant expression.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>