So making your properties ICollection will make it more obvious that the EF creates a bunch of SQL and only returns a List at the end, rather than doing queries for each level of Linq that you use. But that's at the end of your query chain, not at the beginning. The reason List works to begin with is because the EF implementation ends up returning one in the end. ICollection is supported, and will allow you to both query and change data, so use that. Also, what would the index map to? Row number? There aren't a lot of row number queries you'd want to do, and it isn't useful at all in building up bigger queries. Random access by index doesn't map as well, since you'd have to have an existing query result to iterate over, or each random access would query the database again. Out of those, ICollection and IEnumerable map well to database operations, since querying and adding/removing entities are things you might do in a DB.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |