-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use of Context.SaveChanges() in Create() method of EF Repository #10
Comments
Yes it is an expensive commodity - it's one of the things I really dislike about EF - there is a lot I like, but this one area does bug me. I think it should be added in by settings, like "AutoFlush" : true within a config file. |
What exactly you mean with the Autoflush feature? What do you expect it does? When would it save data? With this autoflush features you would expect that when you query the context any created data but not saved in db would be returned because if it still is not saved previously EF will save it? Is this what you mean? Enviado desde mi Windows Phone De: Nicholas Maynemailto:[email protected] Yes it is an expensive commodity - it's one of the things I really dislike about EF - there is a lot I like, but this one area does bug me. I think it should be added in by settings, like "AutoFlush" : true within a config file. Reply to this email directly or view it on GitHub: |
The idea of AutoFlush would be that if you add/update an object, a call to SaveChanges is made. Or alternatively, if you add/update an object we set a isdirty flag, then when making a query that involves that object, we call save changes and then the query will return everything. Not sure... |
I see, I think both alternatives are expensive. |
Removed Repository pattern. |
^ This is the 1st commit message: Add GetCulture() extension method ^ This is the commit message #2: Cleanup ISmsService (#15142) ^ This is the commit message #3: Fix TheAdminTheme layout margin and padding (#15143) ^ This is the commit message #4: Fix SectionDisplayDriver prefix (#15123) ^ This is the commit message #5: Prefill template name when creating a template. (#15145) ^ This is the commit message #6: Set the User Localization feature priority ^ This is the commit message #7: Fix issue with default culture not selected When currentUserCulture is null or supportedCulture doesn't contain currentUserCulture. ^ This is the commit message #8: Update the height of the admin content (#15153) ^ This is the commit message #9: Eliminate the anti-discovery pattern in Elasticsearch (#15134) ^ This is the commit message #10: Renaming and cleaning up search services (#15156) ^ This is the commit message #11: mkdocs-material 9.5.5
Related to Create(T entity) method within EF repository to what extend is useful to use Context.SaveChanges() within Create method?
I mean, I understand you use it for having available for next queries the entitity you just added. But it is an expesive price for having this commodity. In your opinion is this commodity really a need?
I mean in Orchard 1.8 the current code that consumes Repository really harness this commodity?
How much code? Can you point me an example? Will it be difficult to change that code that adds and consumes data to delegate on it the decission of when to call context.SaveChanges()?
The text was updated successfully, but these errors were encountered: