How to... Display Data from Database
<p>I've got an Application which consists of 2 parts at the moment</p>

<ol>
<li>A Viewer that receives data from a database using EF</li>
<li>A Service that manipulates data from the database at runtime.</li>
</ol>

<p>The logic behind the scenes includes some projects such as repositories - data access is realized with a unit of work. The Viewer itself is a WPF-Form with an underlying ViewModel.</p>

<p>The ViewModel contains an ObservableCollection which is the datasource of my Viewer.</p>

<p>Now the question is - How am I able to retrieve the database-data every few minutes? I'm aware of the following two problems:</p>

<ol>
<li><s>It's not the latest data my Repository is "loading" - does EF "smart" stuff and retrieves data from the local cache? If so, how can I force EF to load the data from the database?</s></li>
<li><s>Re-Setting the whole ObservableCollection or adding / removing entities from another thread / backgroundworker (with invokation) is not possible. How am I supposed to solve this?</s></li>
</ol>

<p>I will add some of my code if needed but at the moment I don't think that this would help at all.</p>

<p><strong>Edit:</strong></p>

<pre><code>public IEnumerable&lt;Request&gt; GetAllUnResolvedRequests() {
        return AccessContext.Requests.Where(o =&gt; !o.IsResolved);
    }
</code></pre>

<p>This piece of code won't get the latest data - I edit some rows manually (set IsResolved to true) but this method retrieves it nevertheless.</p>

<p><strong>Edit2:</strong>  </p>

<p><a href="https://i.stack.imgur.com/cb9he.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cb9he.png" alt="Properties after editing data manually in database"></a></p>

<p><a href="https://i.stack.imgur.com/B17xQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/B17xQ.png" alt="Data in the database"></a></p>

<p><strong>Edit3:</strong></p>

<pre><code>var requests = AccessContext.Requests.Where(o =&gt; o.Date &gt;= fromDate &amp;&amp; o.Date &lt;= toDate).ToList();
        foreach (var request in requests) {
            AccessContext.Entry(request).Reload();
        }
        return requests;
</code></pre>

<p><strong>Final Question:</strong>
The code above "solves" the problem - but in my opinion it's not clean. Is there another way?</p>