Milos Solution Platformhttp://www.MilosSolutionPlatform.comNews about the Milos Solution Platformen-usEPS Software Corp.Milos TeamMilos Solution Platform - www.MilosSolutionPlatform.comMilos Name Components now support more standard typeshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=e712fbd7-7868-4903-8731-21734d1a1265markus@code-magazine.comTue, 16 Nov 2010 23:51:59 GMThttp://www.MilosSolutionPlatform.com/rss/e712fbd7-7868-4903-8731-21734d1a1265<h1>Milos Name Components now support more standard types</h1><p>We just released up updated version of the Milos name components that support more different standard types of communication information. In particular, we now support the following:</p><ul><li>Twitter <li>Facebook (name and internal ID) <li>LinkedIn <li>Windows Live ID <li>Xing <li>YouTube</li></ul><p>This update also includes an update of the UI components. So for instance, our standard name edit UI now features the following communication type drop down:</p><p><img src="/blogs/images/NameDropDown.jpg"></p><p>All the terms used are fully localizable, btw.</p><br/><br/>Posted @ 5:51 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=e712fbd7-7868-4903-8731-21734d1a1265Silverlight ASP.NET Server Control Updatehttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=5ed4bc5b-79e9-449a-a4e4-1684c72e3e8bmarkus@code-magazine.comSun, 19 Jul 2009 21:16:12 GMThttp://www.MilosSolutionPlatform.com/rss/5ed4bc5b-79e9-449a-a4e4-1684c72e3e8b<h1>Silverlight ASP.NET Server Control Update</h1><p>Here's a bit more on our ASP.NET Silverlight Control <a href="http://www.milossolutionplatform.com/MilosBlog.aspx?messageid=e2903254-2e91-4501-a72d-c5f235d9e648">I talked about recently</a>: We now updated this control to not just be compatible with the old control shipped by Microsoft, but to do things you might find useful. Here is a list of changes:</p>
<ul>
<li>Default minimum version is now set to 3.0</li>
<li>Removed the ScaleMode property, since that just isn't supported by Silverlight anymore</li>
<li>Added the ability to very easily set that a control uses 100% of the available browser space</li>
<li>Added the ability to fire a storyboard in a splash screen XAML file</li>
<li>Added the ability to update a string in the splash screen that represents current download progress</li></ul>
<p>Here is an example aspx file containing a Silverlight control (this one is from www.D2SIG.org):</p>
<p></p>
<p></p><font size=3>
<p></font><font size=2><font face="Courier New">&lt;%</font><font face="Courier New"><font color=#0000ff><font color=#0000ff>@</font></font> <font color=#a31515><font color=#a31515>Page</font></font> <font color=#ff0000><font color=#ff0000>Language</font></font><font color=#0000ff><font color=#0000ff>="C#"</font></font> <font color=#ff0000><font color=#ff0000>AutoEventWireup</font></font><font color=#0000ff><font color=#0000ff>="true"</font></font> <font color=#ff0000><font color=#ff0000>CodeBehind</font></font><font color=#0000ff><font color=#0000ff>="Default.aspx.cs"</font></font> <font color=#ff0000><font color=#ff0000>Inherits</font></font><font color=#0000ff><font color=#0000ff>="D2SIGWeb._Default"</font></font></font><font face="Courier New"> %&gt;<br></font></font><font face="Courier New">&lt;%</font><font face="Courier New"><font color=#0000ff><font color=#0000ff>@</font></font> <font color=#a31515><font color=#a31515>Register</font></font> <font color=#ff0000><font color=#ff0000>assembly</font></font><font color=#0000ff><font color=#0000ff>="SimpleWebControls"</font></font> <font color=#ff0000><font color=#ff0000>namespace</font></font><font color=#0000ff><font color=#0000ff>="EPS.Web.SimpleControls"</font></font> <font color=#ff0000><font color=#ff0000>tagprefix</font></font><font color=#0000ff><font color=#0000ff>="cc1"</font></font> %&gt;<br><br></font><font color=#0000ff><font color=#0000ff><font face="Courier New">&lt;!</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>DOCTYPE</font></font> <font color=#ff0000><font color=#ff0000>html</font></font> <font color=#ff0000><font color=#ff0000>PUBLIC</font></font> <font color=#0000ff><font color=#0000ff>"-//W3C//DTD XHTML 1.0 Transitional//EN"</font></font> </font><font color=#0000ff><font color=#0000ff><font face="Courier New">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br><br></font><font face="Courier New">&lt;</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>html</font></font> <font color=#ff0000><font color=#ff0000>xmlns</font></font><font color=#0000ff><font color=#0000ff>="http://www.w3.org/1999/xhtml"</font></font> </font><font color=#0000ff><font color=#0000ff><font face="Courier New">&gt;<br></font><font face="Courier New">&nbsp; &lt;</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>head</font></font> <font color=#ff0000><font color=#ff0000>runat</font></font><font color=#0000ff><font color=#0000ff>="server"&gt;<br>&nbsp;&nbsp;&nbsp; </font></font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&lt;</font></font><font color=#a31515><font color=#a31515>title</font></font><font color=#0000ff><font color=#0000ff>&gt;</font></font>D2SIG - Developers <font color=#ff0000><font color=#ff0000>&amp;amp;</font></font> Designers Special Interest Group<font color=#0000ff><font color=#0000ff>&lt;/</font></font><font color=#a31515><font color=#a31515>title</font></font></font><font color=#0000ff><font color=#0000ff><font face="Courier New">&gt;<br>&nbsp; </font><font face="Courier New">&lt;/</font></font></font><font color=#a31515><font color=#a31515 face="Courier New">head</font></font><font color=#0000ff><font color=#0000ff><font face="Courier New">&gt;<br>&nbsp; </font><font face="Courier New">&lt;</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>body</font></font><font color=#0000ff><font color=#0000ff>&gt;<br>&nbsp;&nbsp;&nbsp; </font></font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&lt;</font></font><font color=#a31515><font color=#a31515>form</font></font> <font color=#ff0000><font color=#ff0000>id</font></font><font color=#0000ff><font color=#0000ff>="form1"</font></font> <font color=#ff0000><font color=#ff0000>runat</font></font><font color=#0000ff><font color=#0000ff>="server"</font></font> <font color=#ff0000><font color=#ff0000>style</font></font><font color=#0000ff><font color=#0000ff>="</font></font><font color=#ff0000><font color=#ff0000>height</font></font>: <font color=#0000ff><font color=#0000ff>100%</font></font>;<font color=#0000ff><font color=#0000ff>"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&lt;</font></font><font color=#a31515><font color=#a31515>asp</font></font><font color=#0000ff><font color=#0000ff>:</font></font><font color=#a31515><font color=#a31515>ScriptManager</font></font> <font color=#ff0000><font color=#ff0000>ID</font></font><font color=#0000ff><font color=#0000ff>="ScriptManager1"</font></font> <font color=#ff0000><font color=#ff0000>runat</font></font><font color=#0000ff><font color=#0000ff>="server"&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp; </font></font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&lt;/</font></font><font color=#a31515><font color=#a31515>asp</font></font><font color=#0000ff><font color=#0000ff>:</font></font><font color=#a31515><font color=#a31515>ScriptManager</font></font><font color=#0000ff><font color=#0000ff>&gt;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp; &nbsp;&nbsp;&nbsp; </font></font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&lt;</font></font><font color=#a31515><font color=#a31515>cc1</font></font><font color=#0000ff><font color=#0000ff>:</font></font><font color=#a31515><font color=#a31515>Silverlight</font></font> <font color=#ff0000><font color=#ff0000>ID</font></font><font color=#0000ff><font color=#0000ff>="Silverlight1"</font></font> <font color=#ff0000><font color=#ff0000>runat</font></font><font color=#0000ff><font color=#0000ff>="server"</font></font></font><font face="Courier New"> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </font><font face="Courier New"><font color=#ff0000><font color=#ff0000>Source</font></font><font color=#0000ff><font color=#0000ff>="~/ClientBin/D2SIGSL.xap"</font></font></font><font face="Courier New"> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font face="Courier New"><font color=#ff0000><font color=#ff0000>DisplayMode</font></font><font color=#0000ff><font color=#0000ff>="FullBrowser"<br></font></font></font><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font face="Courier New"><font color=#ff0000><font color=#ff0000>SplashScreenSource</font></font><font color=#0000ff><font color=#0000ff>="~/D2SIGLoading.xaml"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</font></font></font><font face="Courier New"><font color=#ff0000><font color=#ff0000>SplashScreenProgressUpdateObjectId</font></font><font color=#0000ff><font color=#0000ff>="ProgressLabel"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </font></font></font><font face="Courier New"><font color=#ff0000><font color=#ff0000>SplashScreenStoryboard</font></font><font color=#0000ff><font color=#0000ff>="Loading"</font></font></font><font color=#0000ff><font color=#0000ff><font face="Courier New">&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&lt;/</font></font><font color=#a31515><font color=#a31515>cc1</font></font><font color=#0000ff><font color=#0000ff>:</font></font><font color=#a31515><font color=#a31515>Silverlight</font></font><font color=#0000ff><font color=#0000ff>&gt;<br>&nbsp;&nbsp;&nbsp; </font></font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&lt;/</font></font><font color=#a31515><font color=#a31515>form</font></font></font><font color=#0000ff><font color=#0000ff><font face="Courier New">&gt;<br>&nbsp; </font><font face="Courier New">&lt;/</font></font></font><font color=#a31515><font color=#a31515 face="Courier New">body</font></font><font color=#0000ff><font color=#0000ff><font face="Courier New">&gt;</font></p>
<p><font face="Courier New">&lt;/</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>html</font></font><font color=#0000ff><font color=#0000ff>&gt;</p></font></font></font>Note that there are no div tags required anymore (you can still add them if you want to, but it is handled by the control automatically). Also, no CSS styles have to be defined for the 100% height and width anywhere. Instead, the DisplayMode of the control is set to FullBrowser, which handles the 100% height and width right in all browsers.
<p></p>Also note that this example fires a storyboard called "Loading", which is inside the resources of the D2SIGLoading.xaml file.
<p></p>Furthermore, that XAML file has a text run called "ProgressLabel" which is automatically updated with the current download percentage rounded to full numbers. The XAML file has a text run inside a textblock that is defined like this:
<p></p><font color=#0000ff size=3><font color=#0000ff size=3>
<p><font size=2 face="Courier New">&lt;</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>TextBlock</font></font><font color=#0000ff><font color=#0000ff> </font></font><font color=#ff0000><font color=#ff0000>Height</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>14</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>HorizontalAlignment</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>Center</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>Width</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>45</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>Canvas.Top</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>54</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>TextAlignment</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>Center</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>Foreground</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>#FF646464</font></font>"</font><font color=#0000ff><font color=#0000ff><font face="Courier New">&gt;<br>&nbsp;&nbsp;&nbsp; </font><font face="Courier New">&lt;</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>Run</font></font><font color=#0000ff><font color=#0000ff> </font></font><font color=#ff0000><font color=#ff0000>x:Name</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>ProgressLabel</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>FontFamily</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>Trebuchet MS</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>Text</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>0</font></font>"<font color=#0000ff><font color=#0000ff>/&gt;&lt;</font></font><font color=#a31515><font color=#a31515>Run</font></font><font color=#0000ff><font color=#0000ff> </font></font><font color=#ff0000><font color=#ff0000>FontFamily</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>Trebuchet MS</font></font>"<font color=#0000ff><font color=#0000ff> </font></font><font color=#ff0000><font color=#ff0000>Text</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>%</font></font>"</font><font color=#0000ff><font color=#0000ff><font face="Courier New">/&gt;<br></font><font face="Courier New">&lt;/</font></font></font><font face="Courier New"><font color=#a31515><font color=#a31515>TextBlock</font></font><font color=#0000ff><font color=#0000ff>&gt;</p></font></font></font>
<p>Note that whatever object is specified as the progress update object must have a Text property of type string. Note that you can create custom objects with that property, which will automatically be updated as progress changes. You could then do whatever you'd like with that value, including parsing it as a number and use that for further calculations.</p>
<p></p>&nbsp;<br/><br/>Posted @ 4:16 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=5ed4bc5b-79e9-449a-a4e4-1684c72e3e8bA Silverlight 3 ASP.NET Host Controlhttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=e2903254-2e91-4501-a72d-c5f235d9e648markus@code-magazine.comFri, 17 Jul 2009 6:44:51 GMThttp://www.MilosSolutionPlatform.com/rss/e2903254-2e91-4501-a72d-c5f235d9e648<h1>A Silverlight 3 ASP.NET Host Control</h1><p>Silverlight 3 has released, and with it have come some changes. One change is that the handy ASP.NET server control provided with Silverlight 2 is no longer supported. The official recommendation from MS is to simply embed client-side HTML tags (div and object tags) or use JavaScript to create an appropriate Silverlight embedding environment.</p>
<p></p>There certainly are upsides to that approach (flexibility and more customization), but there also are downsides (the control made things very simple, and it also allowed for code-behind access to properties on the control). Long story short: There really is no downside&nbsp;to having this control. For this reason, we recreated a Silverlight control 1:1 in the Milos Simple Web Controls assembly that you are probably already using in your ASP.NET apps. The control is 100% compatible. In fact, the only thing you have to change is the registration line of the assembly at the top of the .aspx file (the one that declares the "asp" namespace) so it points at SimpleWebControls.dll, rather than System.Web.Silverlight.dll file used by the Silverlight 2 SDK.
<p></p>Oh, and btw: While we were at it, we made a few small improvements, such as a straightforward way to set the minimum required Silverlight version to 3.0.
<p></p>&nbsp;Note that this also includes the entire design time experience as well as required resources such as images, XAML, and scripts.
<p></p>&nbsp;<br/><br/>Posted @ 1:44 AM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=e2903254-2e91-4501-a72d-c5f235d9e648Self-Hosted WCF Cross-Domain Service Call Policieshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=7efe9e80-171e-4933-9c05-074edb03e06amarkus@code-magazine.comSun, 8 Feb 2009 19:40:56 GMThttp://www.MilosSolutionPlatform.com/rss/7efe9e80-171e-4933-9c05-074edb03e06a<h1>Self-Hosted WCF Cross-Domain Service Call Policies</h1><p>Yesterday I blogged about a new Milos feature that allows to self-host Basic HTTP services, which is a feature that is useful when one has a service that is hosted using other bindings, but wants to expose the Basic HTTP binding in addition to others, which is typically done in Silverlight or browser scenarios (<a href="http://www.milossolutionplatform.com/MilosBlog.aspx?messageid=cb59a3f7-8113-4b56-8a13-10f1112008f9">click here for yesterday's post</a>).</p>
<p></p>When hosting Basic HTTP services for Silverlight, it is also important to know that Silverlight by default can only call services that are part of the same web application as the Silverlight app itself. This will practically&nbsp;never be the case when you self -host a Basic HTTP service. To allow that service to be called from Silverlight, the <strong>service </strong>must opt in to be callable across domains. (Note: Different ports also count as different domains in this case). This is a security restriction to avoid cross-site attacks.
<p>Using the Milos self-host Basic HTTP feature, you can also enable cross-domain calling like so:</p>
<p></p>
<p></p>
<p></p><font size=3>
<p></font><font face="Courier New"><font color=#2b91af size=3><font color=#2b91af size=3>ServiceGarden</font></font><font size=3>.AllowCrossDomainCalls();</p></font></font>For instance, if you want to host a service that is available both over TCP/IP and Basic HTTP and allows cross-domain calls, it could be done like so:
<p></p><font size=3>
<p></font><font color=#2b91af size=3><font face="Courier New" color=#2b91af size=3>ServiceGarden</font></font><font size=3><font face="Courier New">.AllowCrossDomainCalls();<br></font></font><font face="Courier New"><font color=#2b91af size=3><font color=#2b91af size=3>ServiceGarden</font></font><font size=3>.AddServiceHostNetTcp(</font><font color=#0000ff size=3><font color=#0000ff size=3>typeof</font></font><font size=3>(</font><font color=#2b91af size=3><font color=#2b91af size=3>EventService</font></font></font><font size=3><font face="Courier New">));<br></font></font><font face="Courier New"><font color=#2b91af size=3><font color=#2b91af size=3>ServiceGarden</font></font><font size=3>.AddServiceHostBasicHttp(</font><font color=#0000ff size=3><font color=#0000ff size=3>typeof</font></font><font size=3>(</font><font color=#2b91af size=3><font color=#2b91af size=3>EventService</font></font><font size=3>));</p></font></font>
<p></p>Note that the cross-domain call only relates to HTTP based access, but not to other protocols.
<p></p>Note also that the cross-domain call is enabled by means of a policy that is now available. You can browse to that policy using your web browser. For instance, if you run this in a test environment on localhost, you can now browse to <a href="http://localhost/clientaccesspolicy.xml">http://localhost/clientaccesspolicy.xml</a>, to see the exact settings that are exposed. This is what Silverlight accesses to allow a cross-domain call.
<p>Note that it is possible to set additional parameters. In particular, you can specify which sites can make a cross domain call. For instance, if you only want to accept calls from <a href="http://www.microsoft.com/">www.Microsoft.com</a> and <a href="http://www.google.com/">www.Google.com</a>, you can restrict the cross domain calls in the following fashion:</p>
<p></p><font face="Courier New" color=#2b91af size=3>ServiceGarden</font><font face="Courier New" size=3>.AllowCrossDomainCalls(<font color=#0000ff>new</font> Uri[] {<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>new</font> <font color=#2b91af>Uri</font>(<font color=#8b0000>"http://www.Microsoft.com"</font>),<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>new</font> <font color=#2b91af>Uri</font>(<font color=#8b0000>"http://www.Google.com"</font>) });<br></font>
<p>Note that these features are available on the ServiceGarden class as well as the development host. When the development host is used, the policy is listed in the UI as an additional service endpoint.</p>
<p></p>&nbsp;<br/><br/>Posted @ 1:40 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=7efe9e80-171e-4933-9c05-074edb03e06aSelf-Hosting Basic HTTP WCF Serviceshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=cb59a3f7-8113-4b56-8a13-10f1112008f9markus@code-magazine.comSat, 7 Feb 2009 22:46:16 GMThttp://www.MilosSolutionPlatform.com/rss/cb59a3f7-8113-4b56-8a13-10f1112008f9<h1>Self-Hosting Basic HTTP WCF Services</h1><p>Milos provides a real simple way to develop and host (both in runtime as well as debug scenarios) WCF services. This is especially true for binary, TCP/IP based services that are great to use when both the client and the server are .NET applications. Another common scenario is hosting WCF services as HTTP and XML based web services. Especially with Silverlight, basic HTTP based services have gained more importance again. Of course, it is simple to host such services in IIS, and thus we have not provided any special features around that in Milos.</p>
<p></p>At least not so far. One of the&nbsp;scenarios people have pointed out to us (and frankly, we've run into ourselves too) is a deployment of the same service using multiple bindings. Why deploy one app for TCP/IP and then create a separate, ASP.NET based web app for XML web service support?
<p></p>We have now created support for Milos aided, self-hosted Basic HTTP services. This is supported both in the ServiceGarden and development host environments. Here is an example of hosting a service in both TCP/IP and Basic HTTP configurations at the same time:<br><font size=3>
<p></font><font face="Courier New"><font color=#2b91af size=3><font color=#2b91af size=3>ServiceGarden</font></font><font size=3>.AddServiceHostNetTcp(</font><font color=#0000ff size=3><font color=#0000ff size=3>typeof</font></font><font size=3>(</font><font color=#2b91af size=3><font color=#2b91af size=3>EventService</font></font></font><font face="Courier New"><font size=3>));<br></font><font color=#2b91af size=3><font color=#2b91af size=3>ServiceGarden</font></font><font size=3>.AddServiceHostBasicHttp(</font><font color=#0000ff size=3><font color=#0000ff size=3>typeof</font></font><font size=3>(</font><font color=#2b91af size=3><font color=#2b91af size=3>EventService</font></font><font size=3>));</p></font></font>This example was from a runtime deployed service (likely hosted in a Windows Service). The following example shows the same service hosted in the development environment with support for both protocols.<br><font size=3>
<p></font><font face="Courier New"><font color=#0000ff size=3><font color=#0000ff size=3>var</font></font><font size=3> host = </font><font color=#0000ff size=3><font color=#0000ff size=3>new</font></font><font size=3> </font><font color=#2b91af size=3><font color=#2b91af size=3>TestServiceHost</font></font></font><font face="Courier New"><font size=3>();<br>host.AddNetTcpService(</font><font color=#0000ff size=3><font color=#0000ff size=3>typeof</font></font><font size=3>(</font><font color=#2b91af size=3><font color=#2b91af size=3>EventService</font></font></font><font face="Courier New"><font size=3>));<br>host.AddBasicHttpService(</font><font color=#0000ff size=3><font color=#0000ff size=3>typeof</font></font><font size=3>(</font><font color=#2b91af size=3><font color=#2b91af size=3>EventService</font></font><font size=3>));</p></font></font>
<p></p>Accordingly, the ServiceClient class can now also natively open a connection to a Basic HTTP driven service. (Application configuration now supports "BasicHttp" as an additional service binding).
<p></p>Enjoy!
<p></p><br/><br/>Posted @ 4:46 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=cb59a3f7-8113-4b56-8a13-10f1112008f9Dynamic Property and Method Accesshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=d1da0a0c-2531-4957-af20-956cd5c242acmarkus@code-magazine.comTue, 6 Jan 2009 15:47:38 GMThttp://www.MilosSolutionPlatform.com/rss/d1da0a0c-2531-4957-af20-956cd5c242ac<h1>Dynamic Property and Method Access</h1><p>The upcoming version of Milos has a nifty little enhancement in the ObjectHelper class: It makes it easier to dynamically access/set properties and invoke methods. This is useful in scenarios that can otherwise only be handled with Reflection.</p>
<p>Example: Consider a scenario where a customer object is provided by some external system (perhaps from a dynamic language) and you need to access or set a name property. This can now be done like so in Milos:</p>
<p><font face="Courier New"><font color=#0000ff>object</font> customer = GetCustomerObjectFromSomewhere();<br><font color=#0000ff>string</font> firstName = EPS.Utilities.<font color=#008080>ObjectHelper</font>.GetPropertyValue&lt;<font color=#0000ff>string</font>&gt;(customer, <font color=#a52a2a>"FirstName"</font>);<br>EPS.Utilities.<font color=#008080>ObjectHelper</font>.SetPropertyValue(customer, <font color=#a52a2a>"LastName"</font>, <font color=#a52a2a>"Smith"</font>);</p></font>
<p>Note that these methods are also available as extension methods. To use the extension methods, the EPS.Utilities namespace has to be included at a file level, by putting the following using statement at the top of your source file:</p>
<p></p><font face="Courier New"><font color=#0000ff>using</font> EPS.Utilities; </font>
<p></p>Now, the above code can be simplified to the following:
<p></p>
<p></p>
<p><font face="Courier New"><font color=#0000ff>object</font> customer = GetCustomerObjectFromSomewhere();<br><font color=#0000ff>string</font> firstName = customer.GetPropertyValue&lt;<font color=#0000ff>string</font>&gt;(<font color=#a52a2a>"FirstName"</font>);<br>customer.SetPropertyValue(<font color=#a52a2a>"LastName"</font>, <font color=#a52a2a>"Smith"</font>);</p></font>Milos now also makes it easier to invoke methods dynamically. For instance, one can call a method ont he same object like so:
<p></p><font face="Courier New"><font color=#0000ff>string</font>&nbsp;name = customer.InvokeMethod&lt;<font color=#0000ff>string</font>&gt;(<font color=#a52a2a>"GetFullName"</font>, null);&nbsp;</font>
<p>Note that the second parameter is an array of parameters that get passed to the method. For instance, if the GetFullName() method takes an integer and a string parameter, it could be passed like so:</p>
<p></p><font face="Courier New"><font color=#0000ff>object</font>[] parameters = { 0, <font color=#a52a2a>"Test"</font> };<br><font color=#0000ff>string</font>&nbsp;name = customer.InvokeMethod&lt;<font color=#0000ff>string</font>&gt;(<font color=#a52a2a>"GetFullName"</font>, parameters);&nbsp;</font>
<p>Note that C# 4.0 (once released) will provide features to also make it easier to do these things. In C# 4.0, the following syntax would be valid:</p>
<p></p>
<p><font face="Courier New"><font color=#0000ff><strong>dynamic</strong></font>&nbsp;customer = GetCustomerObjectFromSomewhere();<br><font color=#0000ff>string</font> firstName = customer.FirstName;<br>customer.LastName = <font color=#a52a2a>"Smith"</font>;<br><font color=#0000ff>string</font> name = customer.GetFullName(1, <font color=#a52a2a>"Test"</font>);</p></font>The example used here, with the&nbsp;Customer object dynamically retrieved somewhere is one&nbsp;scenario where this is useful. There are other scenarios&nbsp;as well, where generic code is written that can operate on types that are defined elsewhere. Data binding scenarios are one example.
<p></p>&nbsp;&nbsp;<br/><br/>Posted @ 9:47 AM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=d1da0a0c-2531-4957-af20-956cd5c242acObject casting convenience methodshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=08a72732-74fa-41c5-88e9-b63cb5f8ac71markus@code-magazine.comSat, 20 Dec 2008 20:3:34 GMThttp://www.MilosSolutionPlatform.com/rss/08a72732-74fa-41c5-88e9-b63cb5f8ac71<h1>Object casting convenience methods</h1><p>This upcoming version of Milos has a nice little enhancement in the utilities namespace. The DataHelper class now has extension methods that make it very convenient to cast from object types (such as fields in DataSets) to their real types.</p>
<p></p>These helper methods are implemented as extension methods. To use them, you have to add this line of code at the top of your program:
<p></p><font face="Courier New"><font color=#0000ff>using</font> EPS.Utilities;</font>
<p></p>Now, the extension methods are automatically available on all objects. For instance, you can do the following:
<p></p><font face="Courier New"><font color=#008080>DataSet</font> myDs = <font color=#0000ff>this</font>.GetSomeDataSet(); <font color=#008080><font color=#008000>// Assume that we somehow get a DataSet</font><br></font><font color=#008080>DataRow</font> row = myDs.Tables[0].Rows[0];<br><font color=#008080>Guid</font> myGuid = row[<font color=#8b0000>"id"</font>].ToGuidSafe();<br><font color=#0000ff>string</font> myString = row[<font color=#8b0000>"name"</font>].ToStringSafe().Trim();<br><font color=#0000ff>int</font> myInt = row[<font color=#8b0000>"number"</font>].ToIntegerSafe();</font>
<p></p>The main advantage here is that these methods always return valid values, even if the cast object is not valid. For instance, these methods are aware of System.DBNull and they also trap errors.
<p></p>There are a number of different such methods, including the ability to cast to booleans, DateTime, decimal, and so forth (all common value types, basically).
<p></p><br/><br/>Posted @ 2:03 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=08a72732-74fa-41c5-88e9-b63cb5f8ac71Some Enhancements to the Document Management Componentshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=40d8bdb4-722d-4a57-be3f-5d563202a61bmarkus@code-magazine.comSat, 25 Oct 2008 4:49:25 GMThttp://www.MilosSolutionPlatform.com/rss/40d8bdb4-722d-4a57-be3f-5d563202a61b<h1>Some Enhancements to the Document Management Components</h1><p>The upcoming build of Milos has a few small but important enhancements for the digital Document Management components.</p>
<p></p>Most important is the improved support for ASP.NET's routing framework (introduced with ASP.NET 3.5 SP1). This enhancement allows for an arbitrary download URL for file attachments in web applications. For instance, one can create the following URL (or any other arbitrary chosen URL):
<p></p>
<p></p>
<p><a href="http://www.yourdomain.com/Downloads/42f39e5c-a012-4d91-8e78-889f2bdccb4c/MyFile.mp3">http://www.YourDomain.com/Downloads/<u><font color=#0066cc>42f39e5c-a012-4d91-8e78-889f2bdccb4c/MyFile.mp3</a></font></u></p>
<p>A route and handler can be set up for this URL like so:</p>
<p><font face=Consolas><font color=#0000ff>public static class</font> <font color=#008080>RoutingSetup<a href="/wiki/Framework/wc.dll?Framework~EDIT~RoutingSetup">?</a></font><br>{<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>public static void</font> RegisterRoutes<a href="/wiki/Framework/wc.dll?Framework~EDIT~RegisterRoutes">?</a>(<font color=#008080>RouteCollection<a href="/wiki/Framework/wc.dll?Framework~EDIT~RouteCollection">?</a></font> routes)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; routes.Add(<font color=#0000ff>new</font> <font color=#008080>Route</font>(<font color=#800000>"Downloads/{DownloadId}/{FileName}<a href="/wiki/Framework/wc.dll?Framework~EDIT~Downloads/{DownloadId}/{FileName}">?</a>"</font>, <font color=#0000ff>new </font><font color=#008080>FileAttachmentDownloads<a href="/wiki/Framework/wc.dll?Framework~EDIT~FileAttachmentDownloads">?</a></font>()));<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><font color=#0000ff>public class </font><font color=#008080>FileAttachmentsDownloads<a href="/wiki/Framework/wc.dll?Framework~EDIT~FileAttachmentsDownloads">?</a></font> : <font color=#008080>IRouteHandler<a href="/wiki/Framework/wc.dll?Framework~EDIT~IRouteHandler">?</a></font><br>{<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>var</font> handler = <font color=#0000ff>new </font>EPS.Web.DocumentManagementUI.<font color=#008080>RequestHandler<a href="/wiki/Framework/wc.dll?Framework~EDIT~RequestHandler">?</a></font>();<br>&nbsp;&nbsp;&nbsp; <font color=#008080>Guid</font> downloadId = <font color=#0000ff>new </font><font color=#008080>Guid</font>(requestContext.RouteData.GetRequiredString(<font color=#800000>"DownloadId<a href="/wiki/Framework/wc.dll?Framework~EDIT~DownloadId">?</a>"</font>));<br>&nbsp;&nbsp;&nbsp; handler.AttachmentId = downloadId;<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>return</font> handler;<br>}</p>
<p></p>
<p></font>Other enhancements include more automatically determined content types for web downloads (in particular XAML is of importance) and also a few added icons in the windows file attachment grids (MP3 and&nbsp;XAML in particular).</p>
<p></p>&nbsp;<br/><br/>Posted @ 11:49 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=40d8bdb4-722d-4a57-be3f-5d563202a61bBackground Style of Office Edit Formshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=336a10da-0df2-4b95-a694-8a444f2c6228markus@code-magazine.comThu, 23 Oct 2008 23:3:52 GMThttp://www.MilosSolutionPlatform.com/rss/336a10da-0df2-4b95-a694-8a444f2c6228<h1>Background Style of Office Edit Forms</h1><p>Milos edit forms in WinForms that use the office style usually render a background pattern similar to Microsoft Word or Excel. Some people ask to turn that off (and how to achieve that). It is quite simple, actually:</p>
<p></p>Office edit forms have a property called <font face="Courier New">RenderOfficeBackground</font>. If that property is set to <font face="Courier New">false</font>,&nbsp; the normal background color of the form (whatever that property might be set to) is rendered, instead of the fancy Office background pattern.
<p></p><br/><br/>Posted @ 6:03 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=336a10da-0df2-4b95-a694-8a444f2c6228Non-Key Auto-Increment Fieldshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=c3ecb920-f5a7-47ae-ac92-63d0611c9307markus@code-magazine.comThu, 23 Oct 2008 21:43:39 GMThttp://www.MilosSolutionPlatform.com/rss/c3ecb920-f5a7-47ae-ac92-63d0611c9307<h1>Non-Key Auto-Increment Fields</h1><p>Here's a small Milos feature addition that could be of interest to some people: We now support auto-increment fields that aren't key fields. In the past, we only supported such fields when they were in fact key fields (and there is quite a bit of functionality Milos has specific to that). In the latest version, such fields can be any field in the database.</p>
<p></p>Note that it only makes sense to expose such fields as read-only properties in business entities. Also, there is some additional work that needs to be done on the side of the developer to pick up the newest values generated by the database whenever such data gets saved the first time. (And of course, there is some overhead in database access and round trips that should not be underestimated).
<p></p>Also, be aware that we do NOT recommend using this feature whenever the incremental field is used for business logic. Business logic belongs in the middle tier and not the database.
<p></p>So this is a feature that may be valuable but it also should be deployed somewhat carefully. But there you have it: It's now supported.
<p></p><br/><br/>Posted @ 4:43 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=c3ecb920-f5a7-47ae-ac92-63d0611c9307General Milos Newshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=e1b1e993-7f8e-4a21-bb30-2474390f3c4amarkus@code-magazine.comTue, 3 Jun 2008 20:43:58 GMThttp://www.MilosSolutionPlatform.com/rss/e1b1e993-7f8e-4a21-bb30-2474390f3c4a<h1>General Milos News</h1><p>During the week of May 5-9 EPS have hosted the first Milos University training course at the EPS Houston office. The first half of the event was lecture style, presenting the core aspects of Milos, such as its architecture and main components for the data, middle, and UI tiers, and lots of new features have been shown, such as our first components for building WPF applications with Milos, framework components and tools for building service-oriented applications (using WCF), the new DataLoadController component for improved usability and testability, the new framework for unit and integration tests of middle-tier components, the new logging and exception publishing/handling components, new components for building ASP.NET web applications, etc. </p>
<p></p>
<p>The second half of the event was hands-on, and a WinForms application was built with every attendee going through the entire process, step-by-step, including writing unit and integration tests for the middle-tier classes. This sample application will be cleaned up and made available for people to download and play with it soon.</p>
<p></p>
<p>Today we are also rolling out a new version of Milos components, including updated whitepapers and tools. If you are a Milos user, you will be getting the updates through email.</p>
<p></p>
<p>Below is a list of some important things included in this new build.</p>
<p></p>
<p><b>SimpleWPFControls</b></p>
<ul>
<li>Components for building WPF applications using the well-known architecture available in other Milos user-interface components, such as multi-threaded data loading operations, ease-of-use data binding, etc.</li></ul>
<p></p>
<p><b>Milos Services</b></p>
<ul>
<li>Components and tools for building service-oriented applications (and WCF) with Milos.</li></ul>
<p></p>
<p><b>SimpleWebControls</b></p>
<ul>
<li>Improvements for data binding all around</li>
<li>A new data edit panel which mimic WinForms style edit form development more closely on the web</li>
<li><a href="http://www.milossolutionplatform.com/MilosBlog.aspx?messageid=29318330-7996-4dc4-895e-3ef6125acd7a">JQuery support</a></li>
<li>Integrated resource handler</li>
<li>Overlay panel for client side dialogs</li></ul>
<p></p>
<p><b>DeveloperExpressWindows</b></p>
<ul>
<li>A SimpleListPane class to handle panes that launch edit forms.</li>
<li>Added capability to work with new DataLoadController</li></ul>
<p><b>Core</b></p>
<ul>
<li><a href="http://www.milossolutionplatform.com/MilosBlog.aspx?messageid=8dc425ac-0717-40ae-8a71-5325ae9e6457">DataLoadController</a></li>
<li>Improvements to the EditDataLoader (handling of primary/secondary data multi-threaded loading)</li>
<li><a href="http://www.milossolutionplatform.com/MilosBlog.aspx?messageid=a1001c8f-0f3d-4c21-8926-57533b1218f0">Logging components</a></li>
<li><a href="http://www.milossolutionplatform.com/MilosBlog.aspx?messageid=a1001c8f-0f3d-4c21-8926-57533b1218f0">Exception publishing/handling components</a></li>
<li><a href="http://www.milossolutionplatform.com/MilosBlog.aspx?messageid=9c2ead6c-716d-4232-bfdc-90db8fa2ff31">Improved support for Generic collections on entities</a></li></ul>
<p></p>
<p><b>BusinessObjects</b></p>
<ul>
<li>Added simple support for deletion business rules</li>
<li>Added full support for serialization of business entities</li></ul>
<p><b>DataXml</b></p>
<ul>
<li>Improved service for saving byte array data (such as Bitmaps)</li>
<li>Implemented ExecuteScalar method. It supports queries such as "SELECT Column FROM Table WHERE Field = Value", and it'll always return the value of the first column, in the first row, in the first table (in case the query returns more than that). Notice that the XML Data Service does not currently support queries with aggregators, such as "SELECT Count(*) FROM Table".</li>
<li>The service is now read-write when working with data as “embedded resource”. This means that the data can be queried and updated, but that all happens in-memory, so whenever the application is restarted, it uses the original data.</li></ul>
<p><b>TestFramework</b></p>
<ul>
<li>This framework has almost been written from scratch, and it replaces the previous UnitTestFramework and IntegrationTestFramework components.</li>
<li>This new framework addresses several limitations found on the previous ones, and it adds a lot more hooks and features, allowing developers to easily achieve a good code coverage of their business objects and entities.</li></ul>
<p><b>Code Analysis rules</b></p>
<ul>
<li>Fixes to several false positives</li></ul>
<p></p>
<p><b>Business Layer Designer (previous called “Business Entity Generator”)</b></p>
<ul>
<li>Several bug fixes</li>
<li>Improved support for using either Generic or custom collections</li>
<li>Added support for applying any of the business rules that come out of the box to properties on the entity.</li>
<li>Added support for specifying a different base class for business entities.</li>
<li>Added support for specifying a Default Fields and Default Order for the GetList method on business objects.</li></ul>
<p></p>
<p>There is a lot more to come, but we will save that for later.</p><br/><br/>Posted @ 3:43 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=e1b1e993-7f8e-4a21-bb30-2474390f3c4aData Load Controllershttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=8dc425ac-0717-40ae-8a71-5325ae9e6457markus@code-magazine.comWed, 16 Apr 2008 9:8:1 GMThttp://www.MilosSolutionPlatform.com/rss/8dc425ac-0717-40ae-8a71-5325ae9e6457<h1>Data Load Controllers</h1><p>We have recently introduced a fully-automatic way of creating external data loading mechanisms. This is achieved by means of so-called "data load controllers". So what is the basic idea behind these? Well, I am glad you asked! :-)</p>
<p>Milos provides great ways to load data in all kinds of data edit forms, from Windows to the Web, in all kinds of variation. For instance, one can simply use the SetEntityType&lt;&gt;() method to automatically load an entity of a certain type in a window or a web form. It is also possible to override LoadContents() and LoadSecondary() data methods to load additional data, or load it in slightly different ways. </p>
<p></p>
<p>This makes for easy ways of loading data. However, in some scenarios, we want to go even further. (We will always continue to support this approach as it provides the basis for all operations, but we want to provide more options). There are a few scenarios we want to simplify. Here are those considerations:</p>
<ol>
<li>This approach generally relies on inheritance. That is OK in many scenarios, but in some scenarios (such as ASP.NET web forms or WPF/Silverlight XAML), there are scenarios where one just wants to use an object instance for data loading. For instance, one might want to put a data panel into a web form without explicitly subclassing it. Those scenarios are currently supported by means of an event model. That is not a bad approach, but it is slightly different from the inheritance model, and the written code is not IL-compatible, since method signatures are differently, and so forth.
<li>Different interfaces may have a need to load the same data. For instance, 10 different forms of a windows application may need to load certain lookup tables. Or, an ASP.NET web form may need to load the same exact data as the WinForms or WPF equivalent. Neither the inheritance, nor the event model allows for simple code reuse in these scenarios.
<li>It is very hard to unit test data loading for UIs if the code is embedded in, or attached to the user interface classes.</li></ol>
<p>We now provide an additional abstract option: All the data loading (and data handling) code can be put in an abstract class. Here is an example of such a class:</p>
<p></p>
<p></p>
<p><font face="Courier New"><font color=#0000ff>public class</font> <font color=#008080>NameEditLoader</font> : <font color=#008080>DataLoadController</font><br>{<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>public override void</font> Configure()<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff>this</font>.SetEntityType&lt;<font color=#008080>NameBusinessEntity</font>&gt;();<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>public override object</font> LoadSecondaryData()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#008080>NameBusinessObject</font> names = <font color=#008080>NameBusinessObject</font>.NewInstance();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#008080>DataSet</font> dsNames = names.GetList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; names.Dispose();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff>return</font> dsNames;<br>&nbsp;&nbsp;&nbsp; }<br>}</font></p>
<p></p>If you are familiar with current Milos loading code, then you will recognize all of this, because the code is identical to code that would go into a Windows Forms class as well as other types of UI classes. The main difference is that this code now sits in an external class. This class can now be used in an interface class. For instance, it could be used in a Windows Form or a WPF window like so:
<p></p><font face="Courier New"><font color=#0000ff>public</font> MyWindow()<font color=#008080> <font color=#008000>// Constructor</font><br></font>{<br>&nbsp;&nbsp;&nbsp; InitializeComponent();<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>this</font>.DataLoadControllers.Add(<font color=#0000ff>new</font> <font color=#008080>NameEditLoader</font>());<br>}</font>
<p>The same exact object can also be used on a web form:</p>
<p></p><font face="Courier New"><font color=#0000ff>protected void</font> Page_Load(<font color=#0000ff>object</font> sender, <font color=#008080>EventArgs</font> e)<br>{<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>this</font>.dataEditPanel1.DataLoadControllers.Add(<font color=#0000ff>new</font> <font color=#008080>NameEditLoader</font>());<br>}</font>
<p>The same object could also be used in XAML, or in a mobile app, and so forth. Also, the object can now be used stand-alone in unit test scenarios, which is extremely important in test driven development (TDD) and other scenarios where unit tests are needed. (And most applications need unit tests these days).</p>
<p></p>So we think this is a cool change. It is completely optional and everything that was there before is still available. But going forward, this is clearly the recommended approach.
<p></p>&nbsp;<br/><br/>Posted @ 4:08 AM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=8dc425ac-0717-40ae-8a71-5325ae9e6457Milos Web Development supports jQueryhttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=29318330-7996-4dc4-895e-3ef6125acd7amarkus@code-magazine.comThu, 10 Apr 2008 18:3:57 GMThttp://www.MilosSolutionPlatform.com/rss/29318330-7996-4dc4-895e-3ef6125acd7a<h1>Milos Web Development supports jQuery</h1><p>Have you ever used jQuery? (<a href="http://www.jquery.com/">www.jQuery.com</a>). It is a very cool JavaScript library that makes all kinds of client-side HTML development much easier. The most recent version of Milos web control (ASP.NET) now use jQuery for internal stuff and it is also available for you to use in your own client-side efforts. Whenever you include SimpleWebControls.dll in one of your projects, you automatically get access to jQuery stuff. All you have to do is include a script reference, as well as the Milos resource HTTP handler in the web.config (which you should always have anyway). So the web.config needs to have this:</p><font color=#0000ff><font color=#0000ff>
<p><font face="Courier New">&lt;</font></font></font><font color=#a31515><font color=#a31515 face="Courier New">httpHandlers</font></font><font face="Courier New"><font color=#0000ff><font color=#0000ff>&gt;<br>&nbsp;&nbsp;&nbsp; &lt;!-- Other stuff here... --&gt;<br>&nbsp;&nbsp;&nbsp; </font></font><font color=#0000ff><font color=#0000ff>&lt;</font></font><font color=#a31515><font color=#a31515>add</font></font><font color=#0000ff><font color=#0000ff> </font></font><font color=#ff0000><font color=#ff0000>verb</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>*</font></font>"<font color=#0000ff><font color=#0000ff> </font></font><font color=#ff0000><font color=#ff0000>path</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>Milos_simplewebcontrols_*.aspx</font></font>"<font color=#0000ff><font color=#0000ff> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font color=#ff0000><font color=#ff0000>type</font></font><font color=#0000ff><font color=#0000ff>=</font></font>"<font color=#0000ff><font color=#0000ff>EPS.Web.SimpleControls.ResourceRequestHandler,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SimpleWebControls</font></font>"</font><font face="Courier New"><font color=#0000ff><font color=#0000ff>/&gt;<br>&lt;/</font></font><font color=#a31515><font color=#a31515>httpHandlers</font></font><font color=#0000ff><font color=#0000ff>&gt;</p></font></font></font>
<p>With this in place, you can simply add a &lt;script&gt; element to your page to get the jQuery features:</p>
<p></p>
<p></p><font face="Courier New"><font color=#0000ff>&lt;</font><font color=#a52a2a>script</font> <br>&nbsp; <font color=#ff0000>src</font><font color=#0000ff>="</font><font color=#0000ff>milos_simplewebcontrols_getresource.aspx?resourcetype=Script&amp;resourcename=JQuery</font><font color=#0000ff>"</font> <br>&nbsp; <font color=#ff0000>type</font><font color=#0000ff>="</font><font color=#0000ff>text/javascript</font><font color=#0000ff>"&gt;&lt;/</font><font color=#a52a2a>script</font><font color=#0000ff>&gt;</font></font>
<p><em>Note: This aspx page does not really exist. Whenever this URL gets hit, Milos intercepts the call and returns a dynamically generated script stream to the client.</em></p>
<p></p>
<p>With this in place, you can now add jQuery stuff like this:</p>
<p></p><font face="Courier New">$(document).ready(<font color=#0000ff>function</font>() {<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>alert</font>(<font color=#8b0000>"Main document content loaded!"</font>);<br>});<br></font>
<p></p>For more information on jQuery syntax and features, visit <a href="http://www.jscript.com/">www.jscript.com</a>, or get one of the many jQuery books out there (the jQuery site lists several).
<p>Note: Milos also uses jQuery features for some of its advanced scripting. For this reason, it could happen that the script reference gets included multiple times, which could lead to unexpected results. For that reason it is better to add the script reference in the Load() event of the page (or a control) using this code:</p><font size=2>
<p></font><font face="Courier New"><font color=#0000ff size=2><font color=#0000ff size=2>if</font></font><font size=2> (!Page.ClientScript.IsClientScriptIncludeRegistered(</font><font color=#a31515 size=2><font color=#a31515 size=2>"JQuery"</font></font></font><font face="Courier New"><font size=2>))<br>{<br>&nbsp;&nbsp;page.ClientScript.RegisterClientScriptInclude(</font><font color=#a31515 size=2><font color=#a31515 size=2>"JQuery"</font></font><font size=2>,&nbsp;<br>&nbsp;&nbsp;&nbsp; </font><font color=#a31515 size=2><font color=#a31515 size=2>"milos_simplewebcontrols_getresource.aspx?resourcetype=Script&amp;resourcename=JQuery"</font></font></font><font size=2><font face="Courier New">);<br>}</font></p>
<p><font face="Courier New"></font></p>This automatically adds the script reference from above, but it only adds it if the reference isn't there already.
<p></p>There is a lot of cool stuff that can be done with jQuery, from simplified event handling to&nbsp;relatively advanced (for HTML) visual effects. Milos uses this for a number of things, such as the cool new overlay dialogs. But that is a topic of a different post... :-)
<p></p>&nbsp;&nbsp;</font><br/><br/>Posted @ 1:03 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=29318330-7996-4dc4-895e-3ef6125acd7aLessons learned - Little new ones, big old oneshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=696a6f34-0f89-4dbd-a212-ec1ff24b6fa6tchichester@eps-software.comFri, 4 Apr 2008 21:13:44 GMThttp://www.MilosSolutionPlatform.com/rss/696a6f34-0f89-4dbd-a212-ec1ff24b6fa6<h1>Lessons learned - Little new ones, big old ones</h1><p><span style="COLOR: #002060"><font size=3><font face=Calibri>We’ve got an in-house application that we’re working on as a training exercise.&nbsp; Like most projects of this type we find ourselves relearning old lessons.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></font></font></span></p>
<p class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: 115%"><span style="COLOR: #002060"><font size=3><font face=Calibri>We wanted to extend the functionality of the standard windows DateTimePicker control by creating a new composite control with a DateTimePicker and adding spinners for hours/minutes.&nbsp; We started out with the DateTimePicker and two spinners (pretty obvious first step) and gave the class a DateTime property to hold the core DateTime value.&nbsp; We then data bound the DateTimePicker and the two spinners to the DateTime property.&nbsp; The DateTimePicker was bound to the DateTime property and the spinners were hooked up to the hour or minute components of class’ DateTime property.<o:p></o:p></font></font></span></p>
<p class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: 115%"><span style="COLOR: #002060"><font size=3><font face=Calibri>We wired everything up and tried running the shell application.&nbsp; Every time we touched the composite control we got exceptions revolving around one of the constituent controls (dtPicker or spinner) having a null value.&nbsp; Mike Yeager wandered in and made the fateful observation that we had “grossly over engineered” the composite control by having each constituent control separately data bound to the same property.&nbsp; After all, the entire DateTime value was stored within the dateTimePicker control.<o:p></o:p></font></font></span></p>
<p class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: 115%"><span style="COLOR: #002060"><font size=3><font face=Calibri>We removed the databinding of the two spinners to the DateTime property and created properties for hours and minutes that were based on the existing hour/minute components of the dateTimePicker.&nbsp; The getter of the hours/minutes properties returned the hour or minute component of the DateTime value in the dateTimePicker.&nbsp; The setter of the properties called a method that concatenated the year/month/day components of the dateTimePicker with the values of the hour and minute spinners into a new DateTime value.&nbsp; The spinners were hooked up to the hour and minute properties.<o:p></o:p></font></font></span></p>
<p class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: 115%"><span style="COLOR: #002060"><font size=3><font face=Calibri>It took about 15 minutes to scrap the old code, reassemble the controls and properties, and then bind everything together.&nbsp; It worked on the first try!<br><o:p></o:p></font></font></span></p><span style="COLOR: #002060"><font size=3><font face=Calibri>
<ul>
<li>The “new” lesson learned was specific and almost trivial: When extending the functionality of a multi-faceted control, use that control’s internal value as the basis for your work rather than reinvent the (DateTime value) wheel by pushing three separate controls at one value.</li>
<li></font></font></span><span style="COLOR: #002060"><font size=3><font face=Calibri>The “old” lesson is: “Think about what you’re going to do before you even touch the keyboard.&nbsp; You should have a clear vision of your objective before writing the first line of code."<br><br>Claudio will be amplifying on this in his blog, complete with code samples.</font></font></span></li></ul><br/><br/>Posted @ 4:13 PM by Chichester, Thom (<a href="mailto:tchichester@eps-software.com">tchichester@eps-software.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=696a6f34-0f89-4dbd-a212-ec1ff24b6fa6Exception Handling and Logging Frameworkhttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=a1001c8f-0f3d-4c21-8926-57533b1218f0markus@code-magazine.comTue, 5 Feb 2008 22:55:36 GMThttp://www.MilosSolutionPlatform.com/rss/a1001c8f-0f3d-4c21-8926-57533b1218f0<h1>Exception Handling and Logging Framework</h1><p>Milos has always provided features around exception handling. In this upcoming build however, we have formalized a lot of the functionality (and added to it as well) to create two distinct sub-frameworks:</p>
<ol>
<li>An Exception Handling framework</li>
<li>A Logging framework</li></ol>
<p>The idea is the exception logging framework is pretty simple: Whenever an exception occurs that remains unhandled, that exception can be "published" to the exception framework via a so-called "Exception Mediator" object. This object receives the exception and then passes it on to all kinds of interested listeners that can be registered with the mediator. Such listeners could be UI components to show exception information to the user (listener as well as UI components are provided by default and can be extended), or the information can be emailed to an administrator, or perhaps the information needs to be logged. The framework also includes components that can be used to retrieve detailed exception information such as an exception hierarchy or the current call stack.</p>
<p></p>The logging framework can be used to log various information ("events") to different destinations. For instance, it is possible to log events to text files or XML files of various formats. It is also possible to log to the Windows system log on the local machine or a remote machine. Furthermore, it is possible to log to email recipients or the Console or message boxes, or... And of course, it is also possible to easily combine all these loggers and even extend them with your own.
<p></p>In addition to the class reference that includes examples for all these features, we have also written 2 whitepapers that explain the use of these frameworks.
<p></p><br/><br/>Posted @ 4:55 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=a1001c8f-0f3d-4c21-8926-57533b1218f0Generic Sub Item Collections in Business Entitieshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=9c2ead6c-716d-4232-bfdc-90db8fa2ff31markus@code-magazine.comThu, 17 Jan 2008 22:5:40 GMThttp://www.MilosSolutionPlatform.com/rss/9c2ead6c-716d-4232-bfdc-90db8fa2ff31<h1>Generic Sub Item Collections in Business Entities</h1><p>The latest Milos version has a pretty neat enhancement in the business entity model: Sub item collections are now available as generics. Here's why that's cool:</p>
<p></p>So far, in order to create collections of sub items in business entities ("1-to-many relationships"), one had to create the individual item objects, as well as a collection class that could hold those items. The trouble with that is that it is a lot of work to create the collection class, and the only benefit of this class is a strongly typed interface. (The strongly typed interface is needed so one can access parent.Children[x] and then get all the properties on that object).
<p></p>Using the new generic version of the sub item collection, one usually does not have to create a subclass. Instead, one just creates the class for the individual items, and then instantiates the generic version of the collection, with the generic being the item type.
<p></p>Example: An invoice entity with a line item collection could simply instantiate an appropriate collection like so:
<p></p>
<p></p><font face="Courier New"><font color=#0000ff>protected&nbsp;override void&nbsp; </font><font color=#000000>LoadSubItemCollections()</font><br></font><font color=#000000><font face="Courier New">{<br><font color=#0000ff>&nbsp;&nbsp; this</font>.colLineItems = <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff>new </font>GenericEntitySubItemCollection&lt;LineItem&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#0000ff>this</font>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"PK_LineItem",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"FK_Invoice",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Invoices",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"PK_Invoice",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff>this</font>.GetInternalData().Tables["LineItems"] );<br>}
<p></p></font></font>For more details and a detailed explanation, consult the "How-To: Creating a&nbsp;Collection of Child Items" topic in the Milos documentation.
<p></p>Of course, the old way is still supported as well. The main benefit of using the generic version is in creating collections by hand. When using any of the code generator tools, one isn't exposed to the collection anyway (in most cases), so the benefit is minimal. So far, the code generator tools do not use the generic collection yet. There are considerations around backward compatibility. However, we are considering to change the tools in the future...
<p></p><br/><br/>Posted @ 4:05 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=9c2ead6c-716d-4232-bfdc-90db8fa2ff31IBindingList Support on Sub Item Collectionshttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=b385ffb3-9075-44ad-9199-fb826ee9813amarkus@code-magazine.comWed, 5 Dec 2007 17:39:45 GMThttp://www.MilosSolutionPlatform.com/rss/b385ffb3-9075-44ad-9199-fb826ee9813a<h1>IBindingList Support on Sub Item Collections</h1><p>Here is a small feature I really hope everyone appreciates, considering how hard it was to support it in a nice way: All sub item collections in Milos now implement IBindingList, which is a fancy way of saying that they can now be bound to pretty much anything that supports data binding.</p>
<p>In the past, most of the Milos controls supported binding to&nbsp;sub-item collections, but with third party controls, it was hit and miss. Adding support for this interface (in addition to the interfaces we supported previously) pretty much covers the whole range now.</p>
<p></p><br/><br/>Posted @ 11:39 AM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=b385ffb3-9075-44ad-9199-fb826ee9813a'Split-Table' Table Updatedhttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=d19d33c4-a743-4410-b59b-53298df6f698markus@code-magazine.comSat, 13 Oct 2007 16:48:47 GMThttp://www.MilosSolutionPlatform.com/rss/d19d33c4-a743-4410-b59b-53298df6f698<h1>'Split-Table' Table Updated</h1><p>Here is a new feature that only some people will need, but those who need it <em>really</em> do... ;-)</p>
<p>The Milos BusinessObject class features a <em>SaveTable()</em> method, with takes a <em>DataTable</em> as a parameter (among other things) and can then (by means of using various <em>DataService</em> features) simply persist all the changes in the data table back to the database server (whether that's SQL Server or some other database technology). This feature is used extensively by the <em>BusinessEntity</em> infrastructure (among other things). So for instance, when you load a business entity that has a master table and several child tables, each of the tables inside the entity is saved using the <em>SaveTable()</em> method.</p>
<p></p>However, it has been brought to our attention that people sometimes like to load tables into entities or DataSets that are not just simple tables, but they may be created by joins that incorporate multiple tables. In that case the <em>SaveTable()</em> method was not able to save the table, since every record in the <em>DataTable</em> really mapped to different tables in the database. We have now added a feature to Milos that can handle this scenario in many (although not all!) cases. The basic idea is this: We provide a new SaveTable() overload with parameters that allow you to indicate which fields to include in the save operation, and what the table name maps to, and even field maps in case some of the fields are renamed.
<p></p>So let's say you created a join that returned a table that has fields from a <em>Contacts</em> table, such as <em>ContactID</em> (maps to <em>ID</em>), <em>FirstName</em>, <em>LastName</em>, and also fields from a 1:1 joined <em>CustomerInformation</em> table like <em>CustomerID</em> (maps to <em>ID</em>), <em>CustomerNumber</em> and <em>CreditLimit</em>. You could save this information back to the database in a two-step operation, like so:
<p></p><font face="Courier New"><font color=#0000ff>string</font>[] contactFields = <br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>new</font> <font color=#0000ff>string</font>[] { <font color=#a52a2a>"ContactID"</font>, <font color=#a52a2a>"FirstName"</font>, <font color=#a52a2a>"LastName"</font>&nbsp;};<br><font color=#008080>Dictionary</font>&lt;<font color=#0000ff>string</font>, <font color=#0000ff>string</font>&gt;&nbsp;contactFieldMaps = <br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>new</font> <font color=#008080>Dictionary</font>&lt;<font color=#0000ff>string</font>, <font color=#0000ff>string</font>&gt;();<br>fieldMaps.Add(<font color=#a52a2a>"ContactID"</font>, <font color=#a52a2a>"ID"</font>);<br><font color=#0000ff>bool</font> retVal = <font color=#0000ff>this</font>.SaveTable(<br>&nbsp;&nbsp;&nbsp; existingDataSet.Tables[<font color=#a52a2a>"CustInfo"</font>], <font color=#a52a2a>"ID"</font>, <br>&nbsp;&nbsp;&nbsp; <font color=#a52a2a>"Contacts"</font>, contactFields, contactFieldMaps, <font color=#0000ff>false</font>);<br><br><font color=#0000ff>if</font> (retVal)<br>{<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>string</font>[] contactFields = <font color=#0000ff>new</font> <font color=#0000ff>string</font>[] <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <font color=#a52a2a>"CustomerID"</font>, <font color=#a52a2a>"CustomerNumber"</font>, <font color=#a52a2a>"CreditLimit"</font>&nbsp;};<br>&nbsp;&nbsp;&nbsp; <font color=#008080>Dictionary</font>&lt;<font color=#0000ff>string</font>, <font color=#0000ff>string</font>&gt;&nbsp;contactFieldMaps = <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff>new</font> <font color=#008080>Dictionary</font>&lt;<font color=#0000ff>string</font>, <font color=#0000ff>string</font>&gt;();<br>&nbsp;&nbsp;&nbsp; fieldMaps.Add(<font color=#a52a2a>"CustomerID"</font>, <font color=#a52a2a>"ID"</font>);<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>bool</font> retVal = <font color=#0000ff>this</font>.SaveTable(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; existingDataSet.Tables[<font color=#a52a2a>"CustInfo"</font>], <font color=#a52a2a>"ID"</font>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#a52a2a>"CustomerInformation"</font>, contactFields, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contactFieldMaps, <font color=#0000ff>true</font>);<br>}</font><br>
<p>In this example, the first SaveTable() operation is limited to the <em>ContactID</em>, <em>FirstName</em>, and <em>LastName</em> fields. Also, the primary key for the <em>Contacts</em> table is really <em>ID</em>, so we create a map for that. (This works for all fields, not just primary keys). If that save is successful, we perform a second save operation for the remaining fields. Not that in the second operation, we pass a <em>true</em> as the last parameter, which flags the data table as unchanged in memory (this is not done after the first save, since other changes still exist).</p>
<p></p>So this works nicely, but there are a few things you need to know. First, this works best if the table contains 1:1 relationship data. In one-to-many scenarios, the parent "record" exists multiple times, and thus really shouldn't be updated. You can still use the same functionality to update the information from the second part of the table, but you should be very careful updating the parent information, since it will potentially result in multiple updates that can each override each other. Another potential issue is that in memory, each record only has one record state. So the record is either flagged as <em>unchanged</em>, <em>deleted</em>, <em>modified</em>, or <em>added</em>. However, if the parent-part is modified, but the child-part should be considered added, then that would not work and the generated update statements would be incorrect and potentially fail, or - worse - cause incorrect data to be written to the database. So be careful with that.
<p></p>One aspect of this that isn't immediately obvious is that this new functionality can also be used in scenarios where you just query a single table, but the update needs to map field names, or limit the update to certain fields. For instance, if an empty string array of field names is passed to this method and a mapping dictionary is passed, then all fields will be saved, but they can be mapped. Or, you can pass an empty dictionary, but pass a limiting list of field names, to exclude certain fields from update. Both scenarios can be very useful in a number of scenarios.
<p></p>&nbsp;<br/><br/>Posted @ 11:48 AM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=d19d33c4-a743-4410-b59b-53298df6f698Minor String-Array Helper Methodhttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=4b629e6d-861c-4084-993a-271150c26052markus@code-magazine.comFri, 12 Oct 2007 19:26:41 GMThttp://www.MilosSolutionPlatform.com/rss/4b629e6d-861c-4084-993a-271150c26052<h1>Minor String-Array Helper Method</h1><p>This is a pretty small item, but I find it useful in a lot of scenarios: There now is a new ArrayContainsString() method on the StringHelper object. It provides a quick way to check whether a certain string array contains a certain string, and it can do so in a case insensitive fashion:</p><font face="Courier New"><font color=#0000ff>string</font>[] testArray = <font color=#0000ff>new string</font>[] { <font color=#8b0000>"One"</font>, <font color=#8b0000>"Two"</font>, <font color=#8b0000>"Three"</font> };<br><font color=#0000ff>bool</font> result1 = <font color=#008080>StringHelper</font>.ArrayContainsString(testArray, <font color=#8b0000>"one"</font>, <font color=#0000ff>true</font>); <font color=#008000>// returns true</font><br><font color=#0000ff>bool</font> result2 = <font color=#008080>StringHelper</font>.ArrayContainsString(testArray, <font color=#8b0000>"one"</font>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#008000>// returns false</font><br><font color=#0000ff>bool</font> result3 = <font color=#008080>StringHelper</font>.ArrayContainsString(testArray, <font color=#8b0000>"One"</font>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#008000>// returns true<br></font><font color=#0000ff>bool</font> result4 = <font color=#008080>StringHelper</font>.ArrayContainsString(testArray, <font color=#8b0000>"Four"</font>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#008000>// returns false<br></font></font>
<p>As I said, this is not an earth-shaking feature, but it is kinda nifty...</p>
<p></p><br/><br/>Posted @ 2:26 PM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=4b629e6d-861c-4084-993a-271150c26052Automatic Window Title Updates on Navigationhttp://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=62e246c3-95bd-453c-ae2e-ce31b1ca3860markus@code-magazine.comSun, 9 Sep 2007 8:9:34 GMThttp://www.MilosSolutionPlatform.com/rss/62e246c3-95bd-453c-ae2e-ce31b1ca3860<h1>Automatic Window Title Updates on Navigation</h1><p>Here is a small but nice tweak: When using navigation UIs, in particular the Office application forms, or the Developer Express application forms, Milos now supports automatic updates of the windows title (the secondary title, actually), from the pane's caption (the pane the user navigates to). This behavior is optional, and can be controlled by means of the <em>UpdateWindowSubTitleFromNavigation</em> property, which can be found on all app form classes. </p>
<p>Note: Related to this change is an update to the <em>INavigationHost</em> interface, which now features a <em>NavigationCompleted</em> event. If you implement this interface somewhere, you simply need to add that event to your implementation as well. The code required to do so is simple: </p>
<p></p><font face="Courier New"><font color=#808080>/// &lt;summary&gt;<br>/// <font color=#008000>Occurs after a navigation.<br></font>/// &lt;/summary&gt;<br></font><font color=#0000ff>public event</font> System.<font color=#87ceeb>EventHandler</font> NavigationComplete;&nbsp;</font>
<p></p>Whether you actually use the event or not&nbsp;is up to you. However, we recommend&nbsp;you call if after navigating, which is done in the Navigate() method that&nbsp;goes with the same interface. Here is the new standard implementation for that method:&nbsp;
<p></p><font face="Courier New"><font color=#808080>/// &lt;summary&gt;<br>/// <font color=#008000>Triggers a navigation based on the specified URI<br></font>/// &lt;/summary&gt;<br>/// &lt;param name="uri"&gt;<font color=#008000>URI to navigate to</font>&lt;/param&gt;<br>/// &lt;param name="ignoreNavigationHistory"&gt;<font color=#008000>Defines whether the current navigation needs<br></font>///<font color=#008000> to be added to the navigation history. For instance, a go-back operation is already</font> <br>///<font color=#008000> in the history and thus does not have to be added, while a navigation to a new location <br></font>/// <font color=#008000>has to be added to the history.</font>&lt;/param&gt;<br>/// &lt;returns&gt;<font color=#008000>True if navigation is successful</font>&lt;/returns&gt;<br></font><font color=#0000ff>public bool </font>Navigate(<font color=#0000ff>string</font> uri, <font color=#0000ff>bool </font>ignoreNavigationHistory)<br>{<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>bool</font> retVal = <font color=#87ceeb>NavigationHelper</font>.Navigate(uri, <font color=#0000ff>this</font>.History, <font color=#0000ff>this</font>, ignoreHistory, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff>this</font>.ForwardControls, <font color=#0000ff>this</font>.BackwardControls, <font color=#0000ff>this</font>);<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>if</font> (<font color=#0000ff>this</font>.NavigationComplete != <font color=#0000ff>null</font>)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff>this</font>.NavigationComplete(<font color=#0000ff>this</font>, <font color=#0000ff>new </font><font color=#87ceeb>EventArgs</font>());<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <font color=#0000ff>return</font> retVal;<br>}</font>&nbsp;
<p></p>That's it! Small change, but nice to have.
<p></p>&nbsp;&nbsp;<br/><br/>Posted @ 3:09 AM by Egger, Markus (<a href="mailto:markus@code-magazine.com">markus@code-magazine.com</a>)http://www.MilosSolutionPlatform.com/MilosBlog.aspx?messageid=62e246c3-95bd-453c-ae2e-ce31b1ca3860