Replies: 2 comments 2 replies
|
Thanks for starting this discussion, Richard! Re. the operators: here's a discussion about those. But the context there was mostly different; it was related to removing There's a trade off between pure 'domain concepts' and making value objects behave nicely in the infrastructure layer. |

Uh oh!
There was an error while loading. Please reload this page.
While testing the analyzer for #684 I was playing around with various queries and I tried this (using the Onion sample code).
context.Entities.Where(e => e.Name.StartsWith("Fred")).Where(e => e.Id >= id).ToList();The query fails to compile because the
.StartsWith()method and the>=operator don't exist on the Name or Id properties. To get the query to work, I had to cast those properties to their base types.context.Entities.Where(e => ((string)e.Name).StartsWith("Fred")).Where(e => (int)e.Id >= id).ToList();That said, this isn't really a discussion about EF. It's more a discussion about collection filtering in general. For example, it would be a fairly common use case that a domain service will need to filter a collection of entities in some way.
Should we look at extending the source generator to hoist the methods/operators from the base classes we need to better support collection filtering scenarios?
All reactions