<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Rockford Lhotka</title>
  <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/" />
  <link rel="self" href="http://www.lhotka.net/weblog/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2008-07-25T11:06:43.6410144-05:00</updated>
  <author>
    <name>Rockford Lhotka</name>
  </author>
  <subtitle>Author of Expert C#/VB 2005 Business Objects</subtitle>
  <id>http://www.lhotka.net/weblog/</id>
  <generator uri="http://www.dasblog.net" version="2.0.7180.0">DasBlog</generator>
  <entry>
    <title>Randy Pausch, rest in peace</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/RandyPauschRestInPeace.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,f2caf5b2-4826-406f-ad29-aca136c0b263.aspx</id>
    <published>2008-07-25T11:06:43.6410144-05:00</published>
    <updated>2008-07-25T11:06:43.6410144-05:00</updated>
    <content type="html">&lt;p&gt;
&lt;a title="http://www.msnbc.msn.com/id/25848017/" href="http://www.msnbc.msn.com/id/25848017/"&gt;http://www.msnbc.msn.com/id/25848017/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
If you haven't heard the his last lecture, or read the book, you really should. This
guy was one of us, a scientist, a thinker, a man of reason. And his speech is incredibly
thought provoking and powerful.
&lt;/p&gt;
&lt;p&gt;
The world needs more people like Randy Pausch, and it is sad to think we now have
one less.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=f2caf5b2-4826-406f-ad29-aca136c0b263" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>Nice list of things people should know about VB</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/NiceListOfThingsPeopleShouldKnowAboutVB.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,0ac9a6af-cfcd-4696-90e5-20f1c12020f8.aspx</id>
    <published>2008-07-21T08:55:36.7956112-05:00</published>
    <updated>2008-07-21T08:55:36.7956112-05:00</updated>
    <content type="html">&lt;p&gt;
&lt;a title="http://msmvps.com/blogs/kathleen/archive/2008/07/19/what-a-c-coder-should-know-before-they-write-vb.aspx" href="http://msmvps.com/blogs/kathleen/archive/2008/07/19/what-a-c-coder-should-know-before-they-write-vb.aspx"&gt;http://msmvps.com/blogs/kathleen/archive/2008/07/19/what-a-c-coder-should-know-before-they-write-vb.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=0ac9a6af-cfcd-4696-90e5-20f1c12020f8" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>Serious challenge for unit testing in Silverlight</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/SeriousChallengeForUnitTestingInSilverlight.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,1d52c1cc-7311-4e97-87a2-8a906ee619ca.aspx</id>
    <published>2008-07-17T23:44:51.754-05:00</published>
    <updated>2008-07-17T23:45:17.471416-05:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.lhotka.net/weblog/CategoryView,category,Silverlight.aspx" />
    <content type="html">&lt;p&gt;
If you've tried to do any unit testing in Silverlight, you may have run into an interesting
issue. Many times, unit tests &lt;em&gt;expect&lt;/em&gt; exceptions. Tests are written to ensure
that an exception occurs as expected. That's a standard concept in most unit testing
frameworks for .NET.
&lt;/p&gt;
&lt;p&gt;
In Silverlight, there's an "expected CLR behavior" where the debugger will break on
exceptions that are actually handled by user code - treating them like they &lt;em&gt;aren't
handled&lt;/em&gt;. See this thread for some more detail:
&lt;/p&gt;
&lt;p&gt;
&lt;a title=http://silverlight.net/forums/p/20678/72377.aspx#72377 href="http://silverlight.net/forums/p/20678/72377.aspx#72377"&gt;http://silverlight.net/forums/p/20678/72377.aspx#72377&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The result of this, is that you have to employ some ugly workarounds, or you need
to press F5 for each of your tests where you expect an exception.
&lt;/p&gt;
&lt;p&gt;
We're running into this issue in a big way with CSLA Light (CSLA .NET for Silverlight),
because we're creating lots and lots of unit tests, and a fair number of them are
testing to make sure exceptions occur when we expect them.
&lt;/p&gt;
&lt;p&gt;
Of course our unit testing framework (&lt;a href="http://www.codeplex.com/UnitDriven"&gt;UnitDriven&lt;/a&gt;)
uses reflection to run each test method - just like MSTest or nunit - and so even
though we &lt;em&gt;are handling the exception in user code&lt;/em&gt; the debugger insists on
breaking in the test methods themselves where the exceptions occur.
&lt;/p&gt;
&lt;p&gt;
Again, there are workarounds. They prevent you from using the debugger to walk through
your tests - but at least they exist. The whole thing is really sad though - given
that this is apparently &lt;em&gt;intended behavior&lt;/em&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=1d52c1cc-7311-4e97-87a2-8a906ee619ca" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>CSLA Light preview release</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/CSLALightPreviewRelease.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,40e68aa7-d914-41b1-b0bb-0bd0d4b3c9ca.aspx</id>
    <published>2008-07-15T19:40:52.638288-05:00</published>
    <updated>2008-07-15T19:40:52.638288-05:00</updated>
    <category term="CSLA .NET" label="CSLA .NET" scheme="http://www.lhotka.net/weblog/CategoryView,category,CSLA%2B.NET.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://www.lhotka.net/weblog/CategoryView,category,Silverlight.aspx" />
    <content type="html">&lt;p&gt;
I have put a &lt;em&gt;very&lt;/em&gt; early preview release of CSLA Light and CSLA .NET 3.6 online
at &lt;a href="http://www.lhotka.net/cslalight/download.aspx"&gt;www.lhotka.net/cslalight/download.aspx&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
There is no sample app at this point, so you'll have to look at the unit tests in
cslalighttest and cslatest to figure out how to use the various features.
&lt;/p&gt;
&lt;p&gt;
Obviously this is &lt;em&gt;very&lt;/em&gt; early code, but it is healthy to release early and
often, so here we go :)
&lt;/p&gt;
&lt;p&gt;
One side-effect of our work with CSLA Light is that we discovered that testing asynchronous
methods is really hard with nunit and MSTest, and impossible with the Silverlight
unit test framework provided by Microsoft. And yet in Silverlight, async methods are
commonly required, and for parity a number of async features are now also in CSLA
.NET. And we need to have unit tests for them.
&lt;/p&gt;
&lt;p&gt;
To address this issue, we ended up creating our own Silverlight unit testing framework,
and an add-on framework for nunit or MSTest. This allows us to write a common set
of test code that runs in both Silverlight and .NET so we can test both, and establish
that we have parity between them.
&lt;/p&gt;
&lt;p&gt;
Earier today, Justin split this testing framework out of CSLA and we put it up on
CodePlex, calling it &lt;a href="http://www.codeplex.com/UnitDriven"&gt;UnitDriven&lt;/a&gt;.&amp;nbsp;The &lt;a href="http://www.lhotka.net/cslalight"&gt;CSLA
Light project &lt;/a&gt;and &lt;a href="http://www.magenic.com"&gt;Magenic&lt;/a&gt;&amp;nbsp;are donating
the code to the community as an open-source project, because it can be used to build
async unit tests for any app, not just for CSLA Light.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=40e68aa7-d914-41b1-b0bb-0bd0d4b3c9ca" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>Expert 2008 Business Objects tentative TOC</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/Expert2008BusinessObjectsTentativeTOC.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,13d5eecd-78b5-4dc2-a0b1-2ca7c64eff58.aspx</id>
    <published>2008-07-15T10:17:28.039-05:00</published>
    <updated>2008-07-15T11:15:56.9452208-05:00</updated>
    <category term="Books" label="Books" scheme="http://www.lhotka.net/weblog/CategoryView,category,Books.aspx" />
    <category term="CSLA .NET" label="CSLA .NET" scheme="http://www.lhotka.net/weblog/CategoryView,category,CSLA%2B.NET.aspx" />
    <content type="html">&lt;p&gt;
I get a lot of questions about &lt;em&gt;Expert 2008 Business Objects&lt;/em&gt; as to what it
will and won't cover, so I thought I'd try and answer at least some of them in a blog
post.
&lt;/p&gt;
&lt;p&gt;
The book will cover CSLA .NET 3.6. Version 3.6 is the same as 3.5, but with support
for CSLA Light and some .NET 3.5 SP1 features (such as the Entity Framework). And
along with CSLA&amp;nbsp;Light comes some interesting support for things like an async
data portal and async validation rules. But please note that this book &lt;em&gt;will not
cover CSLA Light&lt;/em&gt; - that's a book by itself, believe me!
&lt;/p&gt;
&lt;p&gt;
Here's the tentative table of contents for the book:
&lt;/p&gt;
&lt;font color=#006400&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face=Calibri size=3&gt;&lt;font color=#006400&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt; 
&lt;p class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#008000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;1.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Architecture&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#008000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;2.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Design&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#008000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;3.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Object-oriented
design&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#008000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;4.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Supported
stereotypes&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#008000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;5.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Stereotype
templates&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#008000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;6.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Framework
Implementation&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;7.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Editable
Objects and Collections&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;8.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Data
Binding&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;9.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Business
and Validation Rules&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;10.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Authorization
Rules&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;11.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;N-level
Undo&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;12.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;LINQ
to CSLA&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;13.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Persistence
and the Data Portal&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;14.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Other
Framework Features&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;15.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Example
Business Library&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;16.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WPF
Application&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;17.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Web
Forms Application&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;18.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WCF
Service Application&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&gt;
&lt;p class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&gt;
&lt;p&gt;
&lt;p&gt;
The items in green are complete - first draft anyway - and so you can get an idea
where I am in the process. 
&lt;/p&gt;
&lt;p&gt;
Due to space and time constraints, this book will have three UI chapters just like
the previous books. So I had to choose which interface technologies to cover - out
of the myriad options available:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
WPF 
&lt;li&gt;
WPF/XBAP 
&lt;li&gt;
Windows Forms 
&lt;li&gt;
asmx services 
&lt;li&gt;
WCF services 
&lt;li&gt;
WF workflows and activities 
&lt;li&gt;
ASP.NET Web Forms 
&lt;li&gt;
ASP.NET MVC 
&lt;li&gt;
Office/VSTO (Word, Excel, etc) 
&lt;li&gt;
Console&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I want to make sure to cover smart clients, web development and services. While WCF
and Web Forms were easy choices (though I do like ASP.NET MVC a lot, it isn't mainstream
yet), the choice between Windows Forms and WPF was difficult. But I have to give WPF
the nod, because it is a really nice technology, and it really shows off the power
of CSLA .NET business objects very nicely.
&lt;/p&gt;
&lt;p&gt;
My current plan is to release ebooks that specifically focus on each of the interface
technologies not covered in &lt;em&gt;Expert 2008 Business Objects&lt;/em&gt;, and some sort of
book (ebook or traditional) covering CSLA Light.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=13d5eecd-78b5-4dc2-a0b1-2ca7c64eff58" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>CSLA Light data portal options</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/CSLALightDataPortalOptions.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,1e279556-556f-4c3e-8b81-9db6a3085a07.aspx</id>
    <published>2008-07-14T10:41:52.355-05:00</published>
    <updated>2008-07-14T10:43:06.0911632-05:00</updated>
    <category term="CSLA .NET" label="CSLA .NET" scheme="http://www.lhotka.net/weblog/CategoryView,category,CSLA%2B.NET.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://www.lhotka.net/weblog/CategoryView,category,Silverlight.aspx" />
    <content type="html">&lt;p&gt;
While most people use CSLA .NET because it provides support for data binding, validation,
business rules and authorization, I personally think the coolest part of the framework
is its support for &lt;em&gt;mobile objects&lt;/em&gt;. This support is provided by the data portal,
which provides both an abstract persistence model for business objects, as well as
an implementation of mobile objects with location and network transparency.
&lt;/p&gt;
&lt;p&gt;
CSLA Light will also include a data portal that works in a manner similar to the one
in CSLA .NET. In fact, the two are complimentary - the CSLA Light data portal talks
to the CSLA .NET data portal, because the client is running Silverlight and the server
is running .NET. This occurs when the CSLA Light data portal is running in "remote"
mode - meaning it is talking to a remote data portal server.
&lt;/p&gt;
&lt;p&gt;
The CSLA Light data portal can also run in "local" mode, which means that the "data
access" code runs on the Silverlight client. In reality, this probably means that
your client-side code is directly calling some external service - an asmx web service,
a WCF service, ADO.NET data services, etc. So the fact is that the data access is
still on some server somewhere, but you aren't using the data portal to get from the
client to that server.
&lt;/p&gt;
&lt;p&gt;
As in .NET, when using the data portal in local mode things are pretty simple. A call
to the data portal to fetch an object simply results in a call to a DataPortal_Fetch()
method in your object, and the object is running on the client in Silverlight. What
you do in that DataPortal_Fetch() method is entirely up to you, as long as the object
is populated with data by the time the call completes.
&lt;/p&gt;
&lt;p&gt;
When you use the remote data portal there are more options. Things are somewhat different
from the existing .NET data portal. The following figure will help explain.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.lhotka.net/weblog/content/binary/WindowsLiveWriter/CSLALightdataportaloptions_9674/image_2.png"&gt;&lt;img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=434 alt=image src="http://www.lhotka.net/weblog/content/binary/WindowsLiveWriter/CSLALightdataportaloptions_9674/image_thumb.png" width=397 border=0&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
The CSLA Light data portal interacts with a server (probably a web server, though
it could be a Windows Server 2008 running WAS) through WCF. That server is running
CSLA .NET 3.6, which includes data portal support to listen for CSLA Light data portal
requests. Objects are serialized to/from CSLA Light using the MobileFormatter, which
is a serializer included in both CSLA Light and CSLA .NET that provides a subset of
the functionality provided by the BinaryFormatter (or NetDataContractSerializer),
targeted at the CSLA scenario.
&lt;/p&gt;
&lt;p&gt;
On the web server, CSLA .NET 3.6 receives the inbound client request. Any objects
sent from the client to the server are deserialized (including any criteria objects
or business objects). At this point there are two ways the process will work.
&lt;/p&gt;
&lt;p&gt;
The default option is that the call from the client is "echoed" into the standard
CSLA .NET data portal. In other words, if the client calls Fetch() on the data portal,
that call is relayed into the standard data portal as a Fetch() request. This means
that the .NET data portal applies its normal process and runs in local or remote mode
and ultimately creates an instance of your business object and calls its DataPortal_Fetch()
method. Remember that this is all happening in .NET on the server(s). The resulting
business object is then returned through the .NET data portal to the web server, and
from there through the Silverlight data portal to the client.
&lt;/p&gt;
&lt;p&gt;
So by default, the .NET data portal running on the web server (in the diagram) is
a pass-through from Silverlight into .NET. The end result is that the Silverlight
data portal works just like the .NET data portal does today.
&lt;/p&gt;
&lt;p&gt;
While the default is good and easy, it may not always be ideal. You may not trust
the code running in Silverlight on the client. You may be concerned that the code
has been compromised, that somehow a malicious user cracked into the Silverlight runtime,
mucked around with your code and bypassed your logic. Thus far no one has established
that this can be done, but I can understand the concern.
&lt;/p&gt;
&lt;p&gt;
In that case, another option is that the business class (on the .NET side) can have
a MobileFactory attribute attached:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
[MobileFactory("MyLibrary.CustomerFactory,MyLibrary", "Create", "Fetch", "Update",
"Delete")]&lt;br&gt;
public class Customer : BusinessBase&amp;lt;Customer&amp;gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
If this attribute is applied, the .NET data portal will create an instance of the
type specified in the attribute, and will call methods on that factory object &lt;em&gt;instead
of on the business object&lt;/em&gt;. In other words, a call that &lt;em&gt;would have gone&lt;/em&gt; to
DataPortal_Fetch() will now go to a method matching the third parameter of the attribute
- in this example a method called Fetch().
&lt;/p&gt;
&lt;p&gt;
The factory object is responsible for creating, initializing and returning the object
from create/fetch/update operations. Delete returns nothing. How the factory object
does this is up to the factory author - you. I suspect a very common implementation
will be for the factory method to do extra business checks (validation/authorization)
to decide if the client call is valid, and if it is valid then the factory will just
echo the call into the .NET data portal. So you might write something like this in
a factory:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
public object Fetch(SingleCriteria&amp;lt;Customer, int&amp;gt; criteria)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; // do extra validation/authorization checks here&lt;br&gt;
&amp;nbsp; if (allChecksPassed)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return DataPortal.Fetch(criteria);&lt;br&gt;
&amp;nbsp; else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new Exception("Bad client request");&lt;br&gt;
}
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
A colleague of mine at Magenic, Nermin Dibek, suggested an interesting enhancement
to this MobileFactory model, which I'll include in the implementation. As a configuration
option, you can specify a "factory of factories" object. The default behavior is to
take the type name in the first parameter and use it to create an instance of the
factory object. But if you'd like, you can create your own "factory creator" object
that takes that first parameter and uses it however you'd like to create an instance
of the factory. This would allow you to substitute MyTestLibrary for MyLibrary when
you wanted to use a set of test factories instead of the production versions, and
that sort of thing.
&lt;/p&gt;
&lt;p&gt;
It is my intent to extend this MobileFactory concept into the .NET data portal itself
(in CSLA .NET 3.6), so in a pure-.NET scenario you'd have comparable options, like
this figure:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.lhotka.net/weblog/content/binary/WindowsLiveWriter/CSLALightdataportaloptions_9674/image_4.png"&gt;&lt;img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=406 alt=image src="http://www.lhotka.net/weblog/content/binary/WindowsLiveWriter/CSLALightdataportaloptions_9674/image_thumb_1.png" width=334 border=0&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
The data portal would default to its existing behavior, which would be unchanged.
However, you'd be able to apply an ObjectFactory attribute to your business classes
to indicate that the data portal should route its calls to your factory object rather
than to the DataPortal_XYZ methods.
&lt;/p&gt;
&lt;p&gt;
The only catch here, is that your factory objects then assume responsibility for managing
the status values (IsNew, IsDirty, etc) of the object (and its child objects, etc).
The data portal essentially steps out of the picture entirely - leaving you to do
all the work of creating and manipulating the business object as necessary. However,
this does open up some interesting alternatives for persisting objects even though
the solution is less automated than the current implementation.
&lt;/p&gt;
&lt;p&gt;
The CSLA Light part of what I've discussed here is in the current 3.6 code in Subversion
(svn://svn.lhotka.net/csla/branches/cslacs36 and svn://svn.lhotka.net/csla/trunk/cslalightcs).
The ObjectFactory support for CSLA .NET itself will probably happen in a few weeks.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=1e279556-556f-4c3e-8b81-9db6a3085a07" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>DNR TV show on CSLA .NET 3.5</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/DNRTVShowOnCSLANET35.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,043593eb-3075-45a0-9768-5fa6eae393f2.aspx</id>
    <published>2008-07-11T10:16:28.5628928-05:00</published>
    <updated>2008-07-11T10:16:28.5628928-05:00</updated>
    <content type="html">&lt;p&gt;
You can watch the first of (at least two) dotnetrocks TV shows about CSLA .NET 3.5:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.dnrtv.com/default.aspx?showNum=116"&gt;http://www.dnrtv.com/default.aspx?showNum=116&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In this show I got about half way through discussing the major changes from version
3.0 to 3.5, so Carl and I will need to record another show to finish the discussion.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=043593eb-3075-45a0-9768-5fa6eae393f2" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>VS Live New York and Las Vegas</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/VSLiveNewYorkAndLasVegas.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,648f4f9d-665d-4729-9915-81fd84f9ce59.aspx</id>
    <published>2008-07-01T15:19:06.8525664-05:00</published>
    <updated>2008-07-01T15:19:06.8525664-05:00</updated>
    <content type="html">&lt;p&gt;
&lt;a href="http://www.vslive.com"&gt;VS Live&lt;/a&gt; is coming to New York in September and
Las Vegas in October. I'll be speaking at both events, including a pre-con workshop
covering architecture and design considerations for .NET 2.0 through 3.5 - kind of
a survival guide to the many versions of .NET :)
&lt;/p&gt;
&lt;p&gt;
Of course I use CSLA .NET and CSLA Light to illustrate some of the techniques you
can use to minimize your risk and lower your costs as you migrate from Windows Forms
to WPF or Silverlight, and from Web Forms to ASP.NET MVC or Silverlight. At the same
time, I spend a lot of time talking about most of the various technologies available
- my use of CSLA is incidental rather than central to the talk.
&lt;/p&gt;
&lt;p&gt;
1105 Media (the people who run VS Live) put together this promo video for the show
- I'm in the middle of it for a bit.
&lt;/p&gt;
&lt;p&gt;
&lt;embed src="http://blip.tv/play/9DYBAA" width="250" height="240" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always"&gt;
&lt;/p&gt;
&lt;p&gt;
VS Live is a great show - I hope to see some of you in one of these cities!
&lt;/p&gt;
&gt;&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=648f4f9d-665d-4729-9915-81fd84f9ce59" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>Twin Cities User Groups for Developer Geeks</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/TwinCitiesUserGroupsForDeveloperGeeks.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,0ed2e921-48a0-48f0-a8b8-c77b4258f58d.aspx</id>
    <published>2008-06-25T22:03:29.3785936-05:00</published>
    <updated>2008-06-25T22:03:29.3785936-05:00</updated>
    <content type="html">&lt;p&gt;
It is a good time to be a developer/software geek in the Twin Cities!
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.twincitiesdevelopersguild.com/"&gt;Developer's Guild&lt;/a&gt; - the art
and science of building software 
&lt;li&gt;
&lt;a href="http://www.twincitiesxnausergroup.com/"&gt;XNA user group&lt;/a&gt; - building games
on the Microsoft platform 
&lt;li&gt;
&lt;a href="http://www.twincitieslanguagesusergroup.com/TCLUG/Default.aspx"&gt;Languages
user group&lt;/a&gt; - for that inner language/compiler lover within each of us 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I'll be speaking at the Developer's Guild on August 12, giving a preview of CSLA Light
(CSLA .NET for Silverlight) - probably its first public showing.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=0ed2e921-48a0-48f0-a8b8-c77b4258f58d" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
  <entry>
    <title>CSLA Light data portal and n-level undo</title>
    <link rel="alternate" type="text/html" href="http://www.lhotka.net/weblog/CSLALightDataPortalAndNlevelUndo.aspx" />
    <id>http://www.lhotka.net/weblog/PermaLink,guid,128fd6e9-d778-47cd-be5d-2d0ca98ff765.aspx</id>
    <published>2008-06-24T23:24:09.078-05:00</published>
    <updated>2008-06-24T23:24:38.8012336-05:00</updated>
    <category term="CSLA .NET" label="CSLA .NET" scheme="http://www.lhotka.net/weblog/CategoryView,category,CSLA%2B.NET.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://www.lhotka.net/weblog/CategoryView,category,Silverlight.aspx" />
    <content type="html">&lt;p&gt;
With serialization largely out of the way - or at least under control - as described
in a recent blog post, we've been able to put some focus on a couple other key areas.
&lt;/p&gt;
&lt;h4&gt;N-Level Undo
&lt;/h4&gt;
&lt;p&gt;
The n-level undo functionality in CSLA .NET relies on reflection against private fields.
Obviously that's not possible in Silverlight. Fortunately the serialization scheme
we're using means that there's already a mechanism for trapping the values stored
in the field manager. And there's the OnGetState()/OnSetState() methods that allow
a business developer to trap/restore values in their private fields (if they choose).
So UndoableBase had to be altered to use these techniques rather than using reflection.
The end result is the same, which is what really matters.
&lt;/p&gt;
&lt;p&gt;
We opted not to replicate IEditableObject into CSLA Light. It is a .NET interface
used by Windows Forms data binding, and is the source of never-ending pain thanks
to all the edge cases and idiosyncrasies around this, seemingly simple, interface.
Of course the interface isn't used by Silverlight (or WPF), and so isn't necessary.
The effect of this choice is to simplify quite a bit of the n-level undo code, while
at the same time preserving the shape of the pre-existing &lt;em&gt;public&lt;/em&gt; interface
for all objects. In other words, BeginEdit(), CancelEdit() and ApplyEdit() work as
expected, but you can't use IEditableObject to get at its versions of those methods.
&lt;/p&gt;
&lt;p&gt;
Justin just ran into a strange issue with BusinessListBase, where an attempt to iterate
through the items in the list caused a strange runtime exception from somewhere deep
in the bowels of the Silverlight runtime. It appears there's some issue with a subclass
of a collection iterating through its own items in a foreach loop. A for loop works
fine however, so we have a workaround.
&lt;/p&gt;
&lt;p&gt;
Ultimately however, the ability to easily implement a Cancel button, including when
using modal dialogs (which can be simulated in Silverlight) is supported
&lt;/p&gt;
&lt;h4&gt;Data Portal
&lt;/h4&gt;
&lt;p&gt;
The data portal is coming along pretty well too. It supports a provider model, conceptually
similar to the data portal in .NET. And we currently have two providers: local and
WCF.
&lt;/p&gt;
&lt;p&gt;
One issue we're facing here is that Silverlight has no configuration subsystem comparable
to System.Configuration. So there's no easy way to get configuration data from an
"app.config" file or equivalent. At the moment I've come up with a code-based configuration
scheme - but (unless Microsoft puts out a solution soon) we'll probably end up creating
some embedded resource-based configuration subsystem of our own.
&lt;/p&gt;
&lt;p&gt;
The data portal itself is asynchronous. This changes the way the UI code interacts
with the data portal when compared to .NET code. Rather than just calling DataPortal.Fetch()
to get an object, in Silverlight the UI must call a BeginFetch() method to start the
process and handle a completed event to process any results when they return.
&lt;/p&gt;
&lt;p&gt;
This means the UI code looks something like this:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;var dp = new DataPortal&amp;lt;MockEditableRoot&amp;gt;();&lt;br&gt;
dp.FetchCompleted += new EventHandler&amp;lt;DataPortalResult&amp;lt;MockEditableRoot&amp;gt;&amp;gt;(dp_FetchCompleted); 
&lt;br&gt;
dp.BeginFetch();&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
This code starts the process, and the dp_FetchCompleted is invoked (on the UI thread)
when the call is complete:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;private void dp_FetchCompleted(object sender, DataPortalResult&amp;lt;MockEditableRoot&amp;gt;
e)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; this.DataContext = e.Object;&lt;br&gt;
}&lt;/font&gt; 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Alternately you can wrap this code into a factory method and completed event provided
by the business class. That is a little closer to the typical CSLA .NET model - but
is still async, and the UI still must handle the result in a callback event handler. 
&lt;h5&gt;Local Data Portal
&lt;/h5&gt;
&lt;p&gt;
When using the data portal in local mode, it calls DataPortal_XYZ methods, much like
the .NET data portal. There are a couple interesting differences however. The first
being that the DataPortal_XYZ methods must be public in scope. Remember, no private
reflection, so only public methods can be called.
&lt;/p&gt;
&lt;p&gt;
I debated about using an interface-based approach, but decided against it for a couple
reasons. First, it would be dissimilar to the existing .NET approach. Second, it would
mean that your DataPortal_XYZ methods couldn't be strongly typed - they'd have to
accept parameters of type object and you'd have to cast them to something meaningful.
&lt;/p&gt;
&lt;p&gt;
The second difference flows from the fact that most server-related activities in Silverlight
are asynchronous. Most DataPortal_XYZ methods, therefore, will be invoking async server
calls and getting the results from a callback event. So all DataPortal_XYZ methods
are provided a delegate they can use to do a callback to indicate completion. In a
simple (synchronous) example it looks like this:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;public void DataPortal_Insert(&lt;br&gt;
&amp;nbsp; Csla.DataPortalClient.LocalProxy&amp;lt;MockEditableRoot&amp;gt;.CompletedHandler handler)&lt;br&gt;
{&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New" size=2&gt;&amp;nbsp; LoadProperty&amp;lt;string&amp;gt;(DataPortalMethodProperty,
"insert");&lt;br&gt;
&amp;nbsp; handler(this, null);&lt;br&gt;
} &lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The DataPortal_Insert() method accepts a CompletedHandler parameter it can use to
indicate completion. The call to handler() is the completion call, and the first parameter
is the resulting business object, while the second is an Exception object if you want
to indicate failure.
&lt;/p&gt;
&lt;p&gt;
In an &lt;em&gt;asynchronous&lt;/em&gt; example things are a bit more complex. And the async scenario
is the most common. Typically when using a "local" data portal you'd be doing so because
you want to call some web service or data service from Silverlight. And since all
the server call technologies in Silverlight are async, your DataPortal_XYZ method
will almost certainly be invoking some async service. So more normal code might look
like this:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;public void DataPortal_Insert(&lt;br&gt;
&amp;nbsp; Csla.DataPortalClient.LocalProxy&amp;lt;MockEditableRoot&amp;gt;.CompletedHandler handler)&lt;br&gt;
{&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New" size=2&gt;&amp;nbsp; var svc = new Csla.Testing.Business.TestService.TestServiceClient();&lt;br&gt;
&amp;nbsp; svc.InsertDataCompleted += 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; new EventHandler&amp;lt;Csla.Testing.Business.TestService.InsertDataCompletedEventArgs&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (svc_InsertDataCompleted);&lt;br&gt;
&amp;nbsp; svc.InsertData(GetProperty&amp;lt;string&amp;gt;(DataPortalMethodProperty), handler);&lt;br&gt;
} &lt;/font&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;void svc_InsertDataCompleted(&lt;br&gt;
&amp;nbsp; object sender, Csla.Testing.Business.TestService.InsertDataCompletedEventArgs
e)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; var handler = (Csla.DataPortalClient.LocalProxy&amp;lt;MockEditableRoot&amp;gt;.CompletedHandler)e.UserState;&lt;br&gt;
&amp;nbsp; handler((MockEditableRoot)e.Result, e.Error);&lt;br&gt;
} &lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
This looks a bit odd, but after you do a bit of Silverlight programming this pattern
becomes second nature. 
&lt;/p&gt;
&lt;p&gt;
The DataPortal_XYZ method sets up and starts the call - passing parameters to the
service, and one parameter that is "user state", which is extra (doesn't go to the
server, but stays on the client). Notice that before making the InsertDataAsync()
call, which is the call to the service, the code hooks the InsertDataCompleted event
- this is the event that will be raised (on the UI thread) when the service call completes.
&lt;/p&gt;
&lt;p&gt;
The svc_InsertDataCompleted() method is the event handler. This is where you write
the code to handle the results from the service call. When using the data portal,
this is where you call back into CSLA to indicate that the call is complete. Ultimately
CSLA will return the result to the UI code, but this mechanism allows CSLA to do any
extra processing between the DP_XYZ call and the UI so it can manage the state of
your business object.
&lt;/p&gt;
&lt;p&gt;
You can also shrink this by using a lambda:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;public void DataPortal_Insert(&lt;br&gt;
&amp;nbsp; Csla.DataPortalClient.LocalProxy&amp;lt;MockEditableRoot&amp;gt;.CompletedHandler handler)&lt;br&gt;
{&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New" size=2&gt;&amp;nbsp; var svc = new Csla.Testing.Business.TestService.TestServiceClient();&lt;br&gt;
&amp;nbsp; svc.InsertDataCompleted += (o, e) =&amp;gt; { handler((MockEditableRoot)e.Result,
e.Error); };&lt;br&gt;
&amp;nbsp; svc.InsertDataAsync(GetProperty&amp;lt;string&amp;gt;(DataPortalMethodProperty));&lt;br&gt;
} &lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
That eliminates the need for a separate event handler method and simplifies the code.
&lt;/p&gt;
&lt;h5&gt;Remote Data Portal
&lt;/h5&gt;
&lt;p&gt;
The remote data portal option works very much like the normal .NET data portal, and
is generally simpler to use that the local data portal. When the data portal is configured
to use the WcfProxy, it will use WCF to communicate with a CSLA .NET data portal on
the web/app server.
&lt;/p&gt;
&lt;p&gt;
In this scenario you need a web or app server that is hosting a CSLA .NET data portal
- the .NET end of the CSLA Light data portal. The CSLA Light code running on the Silverlight
client will call the CSLA .NET code running on the app server.
&lt;/p&gt;
&lt;p&gt;
When using a remote data portal, the Silverlight business object &lt;em&gt;will not include
any DataPortal_XYZ methods&lt;/em&gt;. The DataPortal_XYZ methods will only be implemented
in the .NET code, and will only exist on the server. The client-side code will still
call the data portal, but the call will be automatically routed through WCF to the
app server.
&lt;/p&gt;
&lt;p&gt;
This is exactly the same kind of behavior you'd get from the existing .NET data portal
- you can choose to use a local or remote data portal, but the business object and
UI code are the same either way (with the exception that a local data portal requires
implementation of DataPortal_XYZ methods).
&lt;/p&gt;
&lt;p&gt;
On the app server, which is running CSLA .NET, requests will come in from the Silverlight
client. These requests can be handled in one of two ways.
&lt;/p&gt;
&lt;p&gt;
The default is for the client call to be routed into the CSLA .NET data portal, and
the rest of the processing is normal CSLA .NET processing. In other words, a Silverlight
Fetch() call results in a DataPortal.Fetch() call on the app server, which runs the
DataPortal_Fetch() method just like it always has. The result of the data portal call
on the app server is then returned to the Silverlight client.
&lt;/p&gt;
&lt;p&gt;
I call that the "pass-through" mode because the server-side data portal just passes
the client call through to the "real" data portal. And this is a great option for
when you trust the client that is running the Silverlight app, because it requires
the least amount of code and provides the simplest solution.
&lt;/p&gt;
&lt;p&gt;
But if you don't trust the Silverlight client. If you are worried that someone will
break into the Silverlight runtime and somehow put bad data into your object's fields
(perhaps bypassing your business logic, etc), then extra precautions are required.
To address that concern, the server-side data portal can optionally invoke an "observer"
or "factory" (I'm still debating the name of this thing).
&lt;/p&gt;
&lt;p&gt;
To do this, on your server-side business object code (in the server-only partial class)
you use the MobileFactory attribute to specify the type name of the factory object,
and the method names to be called for create, fetch, update and delete operations
(the only operations the data portal supports).
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;[MobileFactory("MyProject.MyFactory, MyProject", "Create",
"Fetch", "Update", "Delete")]&lt;br&gt;
public partial class MockEditableRoot&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Then you must implement the factory class:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;public class MyFactory&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; public object Create(object criteria)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // create, initialize and return new object here&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp; public object Fetch(object criteria)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // create, load and return object here&amp;nbsp; 
&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp; public object Update(object inbound)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // insert, update or delete object here&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // return resulting object&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp; public void Delete(object criteria)&lt;br&gt;
&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // delete object here&amp;nbsp; 
&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The criteria or business object from the client does materialize on the server. Of
course on the server it materializes within &lt;em&gt;code you control&lt;/em&gt;, and so you
can safely interact with the object from within the methods of this factory. Here,
you can force re-running of the validation rules, apply extra authorization rules
or other processing you see fit - all on the app server. Only if you are happy with
the object would you then invoke the "real" data portal to actually allow the persistence
to occur.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=128fd6e9-d778-47cd-be5d-2d0ca98ff765" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;div style="border-top: 1px dotted;padding-top: 8px;padding-bottom: 5px;margin-top: 10px;margin-bottom: 0px;font-family: Verdana;font-weight: normal;line-height: 100%;text-align: left;"&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag Start --&gt;
&lt;script type="text/javascript" src="http://ads.aspalliance.com/displayad.aspx?t=3&amp;m=90&amp;guid=4"&gt;&lt;/script&gt;
&lt;!-- Text Ads - Product Spotlight Ad Tag End --&gt;
&lt;br clear="all"&gt;
&lt;/div&gt;
  </content>
  </entry>
</feed>