Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COThanks Yakimych, I understand I can do this, but what I was looking to find out is whether, using my ObjectContext as a 'Unit of Work', I can or should be able to access all objects within the scope of the ObjectContext without always having to do a union of the ObjectQuery results and the ObjectStateManager results. I have added and analogy using SQL as to what I was hoping to achieve.
      singulars
    2. COAs I mentioned in the post, trying to access a query via `objectContext.Person` will result in a DB query, so basically it will reflect the data in your DB at the moment. One can argue whether it's a good or bad implementation, but that's how it is implemented. As a result (answering your question), you cannot access any unpersisted objects/changes without using `ObjectStateManager`. This issue has been up for debate, btw. Check out this topic for clarifications: http://stackoverflow.com/questions/3118769/is-entity-framework-objectcontext-correct-implementation-of-unit-of-work-pattern
      singulars
    3. COThanks Yakimych. For what it is worth, I hope MS change this implementation as I don't want to have 2 ways to access objects, it means the next layer up has to know too much about the way objects are stored. Also I don't even really want to know whether the Where method makes a DB call, I don't even want to know there is a db. It would be much more intuitive if the ObjectSet reflected all the unpersisted changes. Surely this is what the "Context" in DataContext should stand for otherwise the object should be called a DataOutOfContext object :)
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload