-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveRecord - IsLoaded not set true when query is executed #32
Comments
Perhaps this should actually be a call to item.SetIsLoaded(true) inside the database.Load<t>() call? |
I don't follow you - I need to repro this. |
(that's me btw) |
hehe :) it goes like this for me... var list = (from p in data.products.all() where p.createdOn > now select p).ToList() The object is created in Database.ToEnumerable(), calling the default constructor which sets IsNew=true. The Database.Load() function then populates the object /t/. The only places in the object that set IsLoaded are the Load(reader,...) functions and SetIsLoaded(). Since the object didn't load itself (database.load did), and SetIsLoaded did not get called, the object is not marked that way. It also means that IsNew does not get reset to false. I noticed this because it causes the IsDirty property to fail, since that reliese on _dirtyColumns which is not populated by the setter since _isLoaded is false. |
Great - thank you! Fixed... |
Executing a linq query casues the IsNew flag to get True, but the IsLoaded flag to be False.
I am not sure what that the isLoaded flag is intended to mean, but I take it that it refers to the object being loaded from the db. The generated class's Load() method doesn't get called, it all happens in subsonic.extensions.database.ToEnumerable<t> (which creates the type, then calls database.Load<t>), which never sets the _isLoaded flag.
Since <t> is IActiveRecord, should it be calling instance.Load(reader, false)?
The text was updated successfully, but these errors were encountered: