<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.lhotka.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>CSLA .NET discussion</title><link>http://forums.lhotka.net/forums/5.aspx</link><description>General discussion about CSLA .NET</description><dc:language /><generator>CommunityServer 2008.5 SP3 (Build: 36.8414)</generator><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52533.aspx</link><pubDate>Fri, 13 Apr 2012 19:09:58 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52533</guid><dc:creator>JCardina</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52533.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52533</wfw:commentRss><description>&lt;p&gt;Tiago, I tried that but could not get it to work, the other method worked though. &amp;nbsp;Thank you though for posting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52532.aspx</link><pubDate>Fri, 13 Apr 2012 19:08:35 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52532</guid><dc:creator>JCardina</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52532.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52532</wfw:commentRss><description>&lt;p&gt;Ok, this works very well and just to be explicit for future readers here is how I implemented this in my quick test:&lt;/p&gt;
&lt;p&gt;In my&amp;nbsp;ReadOnlyListBase list object I&amp;#39;ve added a property:&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;public LinqObservableCollection&amp;lt;PartListInfo&amp;gt; IntegratedSortedList&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&amp;nbsp;get&amp;nbsp;{&amp;nbsp; return this.ToSyncList(from r in this orderby r.DisplayName select r);&amp;nbsp; }&amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;And confirmed it works (visually) &amp;nbsp;at the unit test level:&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;i&gt;var v= c.IntegratedSortedList;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;/i&gt;&lt;i&gt;&amp;nbsp;StringBuilder sb = new StringBuilder();&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;foreach(PartListInfo i in v.QueryResult) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp; sb.AppendLine(i.DisplayName);&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;I realize the UI would normally be responsible for how the list is sorted in many cases but this is being called by third parties at the business object level who expect it to be sorted in advance so in this circumstance this is a useful technique. &amp;nbsp;Thanks everyone!&lt;/p&gt;
&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52530.aspx</link><pubDate>Fri, 13 Apr 2012 18:45:00 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52530</guid><dc:creator>JCardina</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52530.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52530</wfw:commentRss><description>&lt;p&gt;&lt;blockquote&gt;&lt;div&gt;&lt;img src="http://forums.lhotka.net/Themes/hawaii/images/icon-quote.gif"&gt; &lt;strong&gt;RockfordLhotka:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/p&gt;
&lt;p&gt;To use extension methods you must have a using or Imports statement to bring the namespace into scope, then the extension methods should be available on any instance of a type that has been extended.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;Thanks Rocky, just for future reference the extension methods are in the CSLA namespace so a using reference to CSLA needs to be included. &amp;nbsp;I didn&amp;#39;t pick it up automatically because I&amp;#39;m doing this in a unit test which doesn&amp;#39;t normally reference CSLA namespace.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52522.aspx</link><pubDate>Fri, 13 Apr 2012 04:22:32 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52522</guid><dc:creator>RockfordLhotka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52522.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52522</wfw:commentRss><description>&lt;p&gt;To use extension methods you must have a using or Imports statement to bring the namespace into scope, then the extension methods should be available on any instance of a type that has been extended.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52521.aspx</link><pubDate>Fri, 13 Apr 2012 03:09:48 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52521</guid><dc:creator>JonnyBee</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52521.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52521</wfw:commentRss><description>&lt;p&gt;ToSyncList() is an extension method in LinqObservableCollection.cs (Csla 4.x). &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52519.aspx</link><pubDate>Thu, 12 Apr 2012 22:57:50 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52519</guid><dc:creator>Tiago Freitas Leal</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52519.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52519</wfw:commentRss><description>&lt;pre style="font-family:Consolas;background:white;color:black;font-size:13px;"&gt;&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt;&amp;nbsp;Sorts&amp;nbsp;a&amp;nbsp;FolderList&amp;nbsp;ready&amp;nbsp;for&amp;nbsp;TreeView.&lt;/span&gt;
&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style="color:gray;"&gt;///&lt;/span&gt;&lt;span style="color:green;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color:gray;"&gt;&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span style="color:blue;"&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color:darkblue;"&gt;IOrderedEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:darkblue;"&gt;FolderInfo&lt;/span&gt;&amp;gt;&amp;nbsp;&lt;span style="color:darkcyan;"&gt;Sorted&lt;/span&gt;()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:blue;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="color:blue;"&gt;this&lt;/span&gt;.&lt;span style="color:darkcyan;"&gt;OrderBy&lt;/span&gt;(n&amp;nbsp;=&amp;gt;&amp;nbsp;n.&lt;span style="color:purple;"&gt;FolderName&lt;/span&gt;).&lt;span style="color:darkcyan;"&gt;OrderBy&lt;/span&gt;(p&amp;nbsp;=&amp;gt;&amp;nbsp;p.&lt;span style="color:purple;"&gt;ParentFolderID&lt;/span&gt;).&lt;span style="color:darkcyan;"&gt;OrderBy&lt;/span&gt;(l&amp;nbsp;=&amp;gt;&amp;nbsp;l.&lt;span style="color:purple;"&gt;FolderLevel&lt;/span&gt;);
}&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52518.aspx</link><pubDate>Thu, 12 Apr 2012 22:16:45 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52518</guid><dc:creator>JCardina</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52518.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52518</wfw:commentRss><description>&lt;p&gt;Interesting and I&amp;#39;ll certainly find that useful for any UI work I do but this object is part of a business object API used by 3rd party people who would expect the list to be in alpha order.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Perhaps the ToSyncList method might be the answer if there is no way to re-order the existing ReadOnlyBase list.&amp;nbsp; However I&amp;#39;m not sure where ToSyncList comes from.&amp;nbsp; For example if I try your sample code in a unit test ToSyncList is unrecognized so it&amp;#39;s not a method of ReadOnlyBase, where do I find that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52517.aspx</link><pubDate>Thu, 12 Apr 2012 20:27:52 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52517</guid><dc:creator>JonnyBee</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52517.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52517</wfw:commentRss><description>&lt;p&gt;I often view this kind of sorting as a UI technology requirement - not necessarily the Business Object.&lt;/p&gt;
&lt;p&gt;IE: For WindowsForms use SortedBindingList wrapper class.&lt;/p&gt;
&lt;p&gt;For other UI technologies use LINQ and ToSyncList() extension method to get a sorted list that maps to the underlying list. &lt;/p&gt;
&lt;p&gt;Example: &lt;/p&gt;
&lt;pre&gt;      var source = TestList.GetList(criteria);
      var synced = source.ToSyncList(from r in source
                                     orderby r.Name
                                     select r);&lt;br /&gt;&lt;br /&gt;and then use synced as the source list in the UI. &lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>CSLA 4.x ReadOnlyListBase sorting after populating from two different sources in list object</title><link>http://forums.lhotka.net/forums/thread/52515.aspx</link><pubDate>Thu, 12 Apr 2012 20:14:06 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:52515</guid><dc:creator>JCardina</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/52515.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=52515</wfw:commentRss><description>&lt;p&gt;I have a scenario where I need to populate a read only list object from two different data sources.&amp;nbsp; That&amp;#39;s not a problem, I&amp;#39;m using encapsulated implementation and just issue two queries sequentially and populate the list first from the first query then secondly from the second query.&lt;/p&gt;
&lt;p&gt;The heart of the issue is that the results returned need to be integrated alphabetically by name.&amp;nbsp; Right now all of query 1&amp;#39;s items come first in the list and query 2&amp;#39;s items come second.&lt;/p&gt;
&lt;p&gt;I can think of all sorts of Rube Goldbergian ways of doing it but I&amp;#39;m wondering if there isn&amp;#39;t a simpler way using LINQ or some other aspect of ROLB I&amp;#39;m unaware of to order the resulting list in place at the business object level before returning it to the UI level.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>