<?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: RE: Struggling with EditableRootList object and LINQ to SQL</title><link>http://forums.lhotka.net/forums/thread/25447.aspx</link><pubDate>Tue, 12 Aug 2008 20:48:51 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:25447</guid><dc:creator>triplea</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/25447.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=25447</wfw:commentRss><description>&lt;P&gt;Not sure if I was too tired or if I changed anything without noticing but the&amp;nbsp;&lt;BR&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;this&lt;/FONT&gt;.Add(&lt;FONT color=#2b91af&gt;&lt;FONT color=#2b91af&gt;DataPortal&lt;/FONT&gt;&lt;/FONT&gt;.FetchChild&amp;lt;&lt;FONT color=#2b91af&gt;&lt;FONT color=#2b91af&gt;Customer&lt;/FONT&gt;&lt;/FONT&gt;&amp;gt;(data));&lt;BR&gt;&lt;/FONT&gt;way seems to be working now...&lt;/P&gt;
&lt;P&gt;Thanks for both your help&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Struggling with EditableRootList object and LINQ to SQL</title><link>http://forums.lhotka.net/forums/thread/25426.aspx</link><pubDate>Tue, 12 Aug 2008 13:42:04 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:25426</guid><dc:creator>RockfordLhotka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/25426.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=25426</wfw:commentRss><description>&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;If you use Csla.Data.ContextManager then keeping the context
alive is just a matter of loading all your child objects inside the using
block.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;using (var ctx = ContextManager&amp;lt;MyDatabase&amp;gt;.GetManager(&amp;#8220;dbName&amp;#8221;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;&amp;nbsp; // load root and all children here&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span&gt;Rocky&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Struggling with EditableRootList object and LINQ to SQL</title><link>http://forums.lhotka.net/forums/thread/25422.aspx</link><pubDate>Tue, 12 Aug 2008 12:18:53 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:25422</guid><dc:creator>Andy</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/25422.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=25422</wfw:commentRss><description>You should look into the Csla.Data.ContextManager.&amp;nbsp; If your root BLB base, your DP_U would look like this:&lt;br&gt;&lt;br&gt;[Transactional( Transaction.TransactionScope )]&lt;br&gt;protected override DataPortal_Update() {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContextManager&amp;lt;MyDataContext&amp;gt; mgr;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using( mgr = ContextManager&amp;lt;MyDataContext&amp;gt;.GetManager() {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do child updates&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;br&gt;&lt;br&gt;In your child object, you get a ContextManager in the same way, and you'll get the one that your root object created.&lt;br&gt;&lt;br&gt;HTH&lt;br&gt;Andy&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Struggling with EditableRootList object and LINQ to SQL</title><link>http://forums.lhotka.net/forums/thread/25418.aspx</link><pubDate>Tue, 12 Aug 2008 08:29:08 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:25418</guid><dc:creator>triplea</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/25418.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=25418</wfw:commentRss><description>&lt;P&gt;Thanks a lot for your input!&lt;/P&gt;
&lt;P&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;RockfordLhotka:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/P&gt;
&lt;P&gt;'data' isn't the full query result though right? You'd be in a foreach loop at this point - looping through the query result, so 'data' is just ONE ITEM from the query result.&lt;/P&gt;
&lt;P&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/P&gt;
&lt;P&gt;Yes thats exactly right, data is only 1 item which is extracted using a foreach loop.&lt;/P&gt;
&lt;P&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;RockfordLhotka:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/P&gt;
&lt;P&gt;As long as your L2S data context is still alive I would expect either approach to work.&lt;/P&gt;
&lt;P&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/P&gt;
&lt;P&gt;How could I ensure that the data context is still alive when I get into the Child_Fetch()? Do I need to use the transactional attribute or manually do something else?&lt;/P&gt;
&lt;P&gt;Also thanks for the BLB/ERLB clarification. In my case I use a BLB as an editable root list.&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: Struggling with EditableRootList object and LINQ to SQL</title><link>http://forums.lhotka.net/forums/thread/25416.aspx</link><pubDate>Tue, 12 Aug 2008 05:00:53 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:25416</guid><dc:creator>RockfordLhotka</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/25416.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=25416</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;triplea:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;P&gt;1. When fetching Customer objects in the DataPortal_Fetch of CustomerList, should I be adding the items like this:&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Add(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;Customer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.GetCustomer(data));&lt;BR&gt;&lt;/FONT&gt;or&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Add(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;DataPortal&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.FetchChild&amp;lt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;Customer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;(data));&lt;/FONT&gt;&lt;BR&gt;or another way?&lt;BR&gt;Data is my LINQ to SQL &lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;var&lt;/FONT&gt;&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/P&gt;
&lt;P&gt;The idea in 3.5 is to use FetchChild() so the data portal can do more work for you. But the old-style approach continues to work as long as you do your own MarkOld() calls, etc.&lt;/P&gt;
&lt;P&gt;'data' isn't the full query result though right? You'd be in a foreach loop at this point - looping through the query result, so 'data' is just ONE ITEM from the query result.&lt;/P&gt;
&lt;P&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;triplea:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/P&gt;
&lt;P&gt;2. In the above scenario, when using the first way, I can jump to other related tables (e.g. customer invoices table) when I am in the Child_Fetch method of Customer. If I use the second way, these related tables throw an System.ArgumentException.&lt;/P&gt;
&lt;P&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/P&gt;
&lt;P&gt;I don't know why that would be the case. Either way the parameter is passed to the new child object, and either way you'd need to know the type of 'data'. As long as your L2S data context is still alive I would expect either approach to work.&lt;/P&gt;
&lt;P&gt;However, FetchChild() does invoke the Child_Fetch() method using reflection, so perhaps L2S gets confused by that?&lt;/P&gt;
&lt;P&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;triplea:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/P&gt;
&lt;P&gt;3. What is the Update method supposed to look like? I was hoping I wouldn't have to implement it (in the same way that Editable Child Lists dont really implement the Update method anymore) but that does not seem to be the case. &lt;/P&gt;
&lt;P&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/P&gt;
&lt;P&gt;An editable child list doesn't need Child_Update(), because CSLA can do it for you.&lt;/P&gt;
&lt;P&gt;An editable &lt;EM&gt;root&lt;/EM&gt; list does need DataPortal_Update() because I don't know how to open your database. &lt;EM&gt;You&lt;/EM&gt; must open the database (or L2S data context), but then you can call base.Child_Update() and let CSLA do most of the work for you:&lt;/P&gt;
&lt;P&gt;protected override void DataPortal_Update()&lt;BR&gt;{&lt;BR&gt;&amp;nbsp; // open database&lt;BR&gt;&amp;nbsp; base.Child_Update(this);&lt;BR&gt;&amp;nbsp; // close database&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;triplea:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/P&gt;
&lt;P&gt;All in all I am not used to use EditableRootLists and am a bit unsure if items witihn the list are supposed to be child objects or not...&lt;/P&gt;
&lt;P&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/P&gt;
&lt;P&gt;BLB and ERLB are very different.&lt;/P&gt;
&lt;P&gt;BLB supports the editable root list and editable child list stereotypes. These do updates in a batch - so the user edits many objects in memory, and they are all saved in one data portal call.&lt;/P&gt;
&lt;P&gt;ERLB supports the dynamic root list stereotype. This is a list of &lt;EM&gt;editable root&lt;/EM&gt; objects with a twist. It contains editable root objects that are &lt;EM&gt;fetched&lt;/EM&gt; somewhat like child objects, and are &lt;EM&gt;saved&lt;/EM&gt; like root objects. As the user completes interacting with each individual object, that object is &lt;EM&gt;immediately saved&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;ERLB is designed specifically to support in-place editing with a Windows Forms grid. While it might work in other scenarios, it is designed specifically for the Windows Grid and in-place editing, where the user's changes are committed &lt;EM&gt;immediately&lt;/EM&gt; as the user moves off each row.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Struggling with EditableRootList object and LINQ to SQL</title><link>http://forums.lhotka.net/forums/thread/25400.aspx</link><pubDate>Mon, 11 Aug 2008 19:59:16 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:25400</guid><dc:creator>triplea</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/25400.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=25400</wfw:commentRss><description>&lt;P&gt;I am struggling to implement a simple EditableRootList object using CSLA 3.5. Lets say I have the following:&lt;BR&gt;&lt;BR&gt;CustomerList : BusinessListBase&amp;lt;CustomerList, Customer&amp;gt; (Root)&lt;BR&gt;Customer: BusinessBase&amp;lt;Customer&amp;gt;&lt;/P&gt;
&lt;P&gt;There are some LINQ to SQL related questions embedded below so its not pure CSLA related but help is appreciated nevertheless :-)&lt;/P&gt;
&lt;P&gt;1. When fetching Customer objects in the DataPortal_Fetch of CustomerList, should I be adding the items like this:&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Add(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;Customer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.GetCustomer(data));&lt;BR&gt;&lt;/FONT&gt;or&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Add(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;DataPortal&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.FetchChild&amp;lt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;Customer&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;(data));&lt;/FONT&gt;&lt;BR&gt;or another way?&lt;BR&gt;Data is my LINQ to SQL &lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;var&lt;/FONT&gt;&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;2. In the above scenario, when using the first way, I can jump to other related tables (e.g. customer invoices table) when I am in the Child_Fetch method of Customer. If I use the second way, these related tables throw an System.ArgumentException.&lt;/P&gt;
&lt;P&gt;3. What is the Update method supposed to look like? I was hoping I wouldn't have to implement it (in the same way that Editable Child Lists dont really implement the Update method anymore) but that does not seem to be the case. &lt;/P&gt;
&lt;P&gt;All in all I am not used to use EditableRootLists and am a bit unsure if items witihn the list are supposed to be child objects or not...&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>