Scenario: Creating a new IQueryable collection, looping through it and setting a certain value for each item looped through.
Issue: However, when using the collection straight after the loop, the value that had just been set was coming through as null.
Solution: IQueryable doesn't allocate memory as it's a copy - just used for querying against a specific data source. So if modification of properties is desired an object will need to be instantiated instead.
Note: This is a refactored snipped of code for the purpose of this blog only.
No comments:
Post a Comment