﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - Access other repository within DetailViewModel</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Access-other-repository-within-DetailViewModel/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Access other repository within DetailViewModel</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Access-other-repository-within-DetailViewModel/</link><pubDate>Mon, 20 Oct 2014 07:15:51 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;You are using LocalEntityRepository. To query data, you can use one of the available methods as follows:&lt;/span&gt;&lt;/p&gt;&lt;ul style="color: #1f497d;"&gt;&lt;li&gt;Task&amp;lt;TEntity&amp;gt; GetSingleAsync(TKey key)&lt;br&gt;Create and execute RestRequest that returns a single entity using the specified key.&lt;/li&gt;&lt;li&gt;Task&amp;lt;ISelectResult&amp;lt;TEntity&amp;gt;&amp;gt; GetAllAsync()&lt;br&gt;Create and execute RestRequest that returns all entities&lt;/li&gt;&lt;li&gt;Task&amp;lt;ISelectResult&amp;lt;TEntity&amp;gt;&amp;gt; GetAllAsync(ISelectParameter selectParameter)&lt;br&gt;Create and execute RestRequest based on the specified select parameter. The select parameter has a QueryDescriptor object that is used to perform data manipulation using OData query.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Note that whenever you retrieve data, the entity will be stored in an &lt;a href="http://developer.intersoftpt.com/display/crosslightapi/EntityContainer+Class" target="_blank"&gt;EntityContainer&lt;/a&gt; in the repository. This allows the &lt;a href="http://developer.intersoftpt.com/display/crosslightapi/EntityContainer+Class" target="_blank"&gt;EntityContainer&lt;/a&gt; to track any changes that happens to your entity so that you can easily send the changes back to the enterprise data service.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;For more detail, please check &lt;a href="http://developer.intersoftpt.com/display/crosslight/Repository+Pattern" target="_blank"&gt;Repository Pattern&lt;/a&gt; article in Crosslight documentation.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;What GetAll() do is:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;public virtual ICollection&amp;lt;TEntity&amp;gt; GetAll()
{
    return this.EntityContainer.FindEntities&amp;lt;TEntity&amp;gt;(FindEntityState.All)
        .Where(o =&amp;gt; o.EntityAspect.EntityState != EntityState.Deleted).ToList();
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;It gets all items using default select parameter from EntityContainer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;The source can be obtained from &lt;a href="http://git.intersoftpt.com/projects/CROS/repos/frameworks/browse/Intersoft.AppFramework" target="_blank"&gt;the git repository&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this help.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Access other repository within DetailViewModel</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Access-other-repository-within-DetailViewModel/</link><pubDate>Thu, 16 Oct 2014 19:24:53 GMT</pubDate><dc:creator>prog1</dc:creator><description>&lt;p&gt;secondRepository.GetAllAsync() is working.&lt;/p&gt;&lt;p&gt;Why does only the async version return the correct result?&lt;/p&gt;</description></item><item><title>Access other repository within DetailViewModel</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Access-other-repository-within-DetailViewModel/</link><pubDate>Wed, 15 Oct 2014 09:29:16 GMT</pubDate><dc:creator>prog1</dc:creator><description>&lt;p&gt;Yes I try to access the Web API with intersoft Entity Data Model.&lt;br&gt;&lt;br&gt;I have registered the repository and resolve it within the ViewModel.&lt;/p&gt;&lt;p&gt;Count will always be 0. But the table contains record.&lt;/p&gt;&lt;pre&gt;var secondRepository = Container.Current.Resolve&amp;lt;ISecondRepository&amp;gt;();
var entires = secondRepository.GetAll().Count;&lt;/pre&gt;
&lt;p&gt;What steps do I have do proceed to register and use the repositories?&lt;/p&gt;</description></item><item><title>Access other repository within DetailViewModel</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Access-other-repository-within-DetailViewModel/</link><pubDate>Wed, 15 Oct 2014 04:58:02 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;I need more information so that I can assist you further.&lt;/span&gt;&lt;/p&gt;&lt;ul style="color: #1f497d;"&gt;&lt;li&gt;are you using Web API?&lt;/li&gt;&lt;li&gt;are you using Intersoft Entity Data Model template?&lt;/li&gt;&lt;li&gt;could you please inform us about the GetAll() method? for example: how do you implement this method?&lt;/li&gt;&lt;/ul&gt;</description></item><item><title>Access other repository within DetailViewModel</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Access-other-repository-within-DetailViewModel/</link><pubDate>Tue, 14 Oct 2014 09:57:42 GMT</pubDate><dc:creator>prog1</dc:creator><description>&lt;p&gt;If I need to access another repository within a DetailViewModel.&lt;/p&gt;&lt;p&gt;How should I do this? I could not find a code snippet for that.&lt;/p&gt;&lt;p&gt;I have tried to resolve the repository from the current container. But GetAll() always returns 0 records.&lt;/p&gt;&lt;p&gt;Kind regards,&lt;/p&gt;&lt;p&gt;Fabian&lt;/p&gt;</description></item></channel></rss>