<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.southworks.net/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.southworks.net/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Jonathan Cisneros</title>
	
	<link>http://blogs.southworks.net/jcisneros</link>
	<description />
	<pubDate>Tue, 04 Nov 2008 02:31:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.southworks.net/jcisneros" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Windows Azure: Everything in the cloud</title>
		<link>http://blogs.southworks.net/jcisneros/2008/11/03/windows-azure-everything-in-the-cloud/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/11/03/windows-azure-everything-in-the-cloud/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 02:31:10 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jcisneros/?p=39</guid>
		<description><![CDATA[These days we are seeing the dawn of a new computing generation, that is the 5th generation of computing. The first one were monolithic applications, then came the Client-Server and tiered applications, and currently we are building Web-based and SOA applications, today, the new buzzwords are Services and Cloud computing.
The past week, on PDC (Professional Developers [...]]]></description>
			<content:encoded><![CDATA[<p>These days we are seeing the dawn of a new computing generation, that is the 5th generation of computing. The first one were <strong>monolithic</strong> applications, then came the <strong>Client-Server</strong> and tiered applications, and currently we are building <strong>Web-based</strong> and <strong>SOA</strong> applications, today, the new buzzwords are <strong>Services</strong> and <strong>Cloud computing</strong>.</p>
<p>The past week, on <a title="Microsoft PDC 2008" href="http://www.microsoftpdc.com/" target="_blank">PDC</a> (Professional Developers Conference) event, Microsoft announced <a title="Windows Azure" href="http://www.microsoft.com/azure/windowsazure.mspx" target="_blank">Windows Azure</a>, a big initiative on the new computing generation. Windows Azure is a &#8220;cloud services operating system&#8221;, this is, a platform for developing, hosting and managing applications and services in the cloud. Being in the <a title="Cloud computing" href="http://en.wikipedia.org/wiki/Cloud_computing" target="_blank">cloud</a>, means that it is hosted on and available from internet, in this case, the hosting service is provided by Microsoft&#8217;s datacenters.</p>
<p>But that is not all, Windows Azure is just the lowest level of the <a title="Azure Service Platform" href="http://www.microsoft.com/azure/default.mspx" target="_blank">Azure Services Platform</a>, this platform includes several services running over Windows Azure, like:</p>
<ul>
<li><strong><a title="Live Services" href="http://dev.live.com/" target="_blank">Live Services</a></strong>: allows to create rich applications to run on a variety of platforms and devices.</li>
<li><strong><a title=".NET Services" href="http://www.microsoft.com/azure/netservices.mspx" target="_blank">.NET Services</a></strong>: includes:
<ul>
<li><strong><a title="Service Bus" href="http://www.microsoft.com/azure/servicebus.mspx" target="_blank">Service Bus</a></strong>: provides a secure, standards-based messaging infrastructure to communicate application components even across organizational boundaries.</li>
<li><strong><a title="Workflow Service" href="http://www.microsoft.com/azure/workflow.mspx" target="_blank">Workflow Service</a></strong>: hosts and runs workflows on the clouds and provides specialized activities for communication using HTTP and Service Bus.</li>
<li><strong><a title="Access Control" href="http://www.microsoft.com/azure/accesscontrol.mspx" target="_blank">Access Control</a></strong>: integrates standards-based identity providers, including enterprise directories and web identity systems such as Windows Live ID.</li>
</ul>
</li>
<li><strong><a title="SQL Services" href="http://www.microsoft.com/azure/sql.mspx" target="_blank">SQL Services</a></strong>: Stores data in the cloud using ACE structure (Authority, Container, Entity), the entities are flexibles and you can access the data using several standards-based interfaces (SOAP, REST, &#8230;).</li>
</ul>
<p><img src="http://www.microsoft.com/azure/images/servicesPlatform.jpg" alt="" /></p>
<p>Being part of this extraordinary family that we call Southworks, gave me the opportunity to learnt about these new technologies and participate in the development of a new set of <strong>Hands-On Labs</strong> about Azure Services Platform for the PDC event. For downloading this HOL go to: <a title="Azure Training Kit" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78" target="_blank">Azure Services Training Kit - PDC Preview</a>.</p>
<p>For further reading:</p>
<ul>
<li><a href="http://msmvps.com/blogs/lopez/archive/2008/11/03/el-cielo-es-azure.aspx">El Cielo es Azure</a> (spanish) by Angel Lopez </li>
<li><a href="http://blogs.southworks.net/jmmoyano/2008/10/30/introduction-to-live-mesh/">Introduction to Live Mesh</a> by Juan Manuel Moyano</li>
<li><a title="Permanent Link to Microsoft Azure Services Management Tools" rel="bookmark" href="http://blogs.southworks.net/lboffi/2008/11/02/microsoft-azure-services-management-tools/">Microsoft Azure Services Management Tools</a> by Leandro Boffi</li>
</ul>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/11/03/windows-azure-everything-in-the-cloud/feed/</wfw:commentRss>
		</item>
		<item>
		<title>.NET Framework 3.5 and Visual Studio 2008 SP1 released!</title>
		<link>http://blogs.southworks.net/jcisneros/2008/08/13/net-framework-35-and-visual-studio-2008-sp1-released/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/08/13/net-framework-35-and-visual-studio-2008-sp1-released/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 00:56:21 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[SP1]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jcisneros/?p=38</guid>
		<description><![CDATA[It&#8217;s awesome how fast time goes, a year ago, I was playing with .bat files (like putting messages in the autoexec.bat file), a month ago, I was building applications to do my accounting homework at highschool using C++ Builder, a week ago, I was making simple games with Visual Basic 6 and then working with [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s awesome how fast time goes, a year ago, I was playing with <strong>.bat</strong> files (like putting messages in the autoexec.bat file), a month ago, I was building applications to do my accounting homework at highschool using <strong>C++ Builder</strong>, a week ago, I was making simple games with <strong>Visual Basic 6</strong> and then working with the same tool, yesterday, I was trying to learn the big <strong>.NET Framework 1.1</strong> and fighting against <strong>ADO.NET</strong> (20 lines to do the same thing that I used to do with three lines in ADO 6!), an hour ago, I was building <strong>ASP.NET 2.0</strong> web sites and <a href="http://www.railsenvy.com/" target="_blank">envying</a> the toys from the <strong>RoR</strong> and <strong>J2EE</strong> guys, now, a minute ago, I helped to create the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=355c80e9-fde0-4812-98b5-8a03f5874e96&amp;displaylang=en" target="_blank">Training Kit</a> for the <a href="http://msdn.microsoft.com/en-us/vstudio/products/cc533447.aspx" target="_blank">.NET Framework 3.5 SP1</a> that seconds ago was released the final version.</p>
<p><strong>A bunch of exiting things are included in the .NET Framework SP1 like:</strong></p>
<ul>
<li><a href="http://www.asp.net/mvc/" target="_blank">ASP.NET MVC Framework</a></li>
<li><a href="http://www.asp.net/dynamicdata/">ASP.NET Dynamic Data</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb399572.aspx" target="_blank">ADO.NET Entity Framework</a></li>
<li><a href="http://codebetter.com/blogs/david.hayden/archive/2008/01/08/getting-started-with-ado-net-data-services.aspx" target="_blank">ADO.NET Data Services</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb412169.aspx" target="_blank">WCF Web Programming Model</a> (RESTful services)</li>
<li>Improved AJAX Support</li>
<li>&#8230;<a href="http://www.microsoft.com/net/WhatsNew.aspx" target="_blank">and much more</a></li>
</ul>
<p><strong>You can get the bits at:</strong></p>
<ul>
<li><a href="http://msdn.microsoft.com/es-es/vstudio/cc533448(en-us).aspx" target="_blank">Visual Studio 2008 Service Pack 1 (SP1) and .NET Framework 3.5 SP1 Downloads</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=355c80e9-fde0-4812-98b5-8a03f5874e96&amp;displaylang=en" target="_blank">.NET Framework 3.5 Enhancements Training Kit</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/08/13/net-framework-35-and-visual-studio-2008-sp1-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ASP.Net Dynamic Data (Scaffolding with .net)</title>
		<link>http://blogs.southworks.net/jcisneros/2008/08/05/aspnet-dynamic-data-scaffolding-with-net/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/08/05/aspnet-dynamic-data-scaffolding-with-net/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 23:40:49 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[SP1]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[Dynamic Data]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jcisneros/2008/08/05/aspnet-dynamic-data-scaffolding-with-net/</guid>
		<description><![CDATA[ When you build data centric web applications, a big part of the code is related to the implementation of CRUD (Create, Read, Updated, Delete) operations. Scaffolding is a mechanism to generate fully functional data driven applications based on metadata inferred from a model, basically, all the CRUD operations are implemented by using the metadata [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blogs.southworks.net/jcisneros/files/2008/08/image.png" border="0" alt="image" width="132" height="240" align="right" /> When you build data centric web applications, a big part of the code is related to the implementation of <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" target="_blank">CRUD</a> (Create, Read, Updated, Delete) operations. <a href="http://en.wikipedia.org/wiki/Scaffold_(programming)" target="_blank">Scaffolding</a> is a mechanism to generate fully functional data driven applications based on metadata inferred from a model, basically, all the CRUD operations are implemented by using the metadata obtained for each entity/table in the model, making it a very useful tool for prototyping.</p>
<p>That is what <a href="http://www.asp.net/dynamicdata/" target="_blank">ASP.Net Dynamic Data</a> does, it is a scaffolding technology that uses templates (ASP.Net Web Pages) to dynamically generate functional CRUD pages. Like <a href="http://www.rubyonrails.org/" target="_blank">Ruby on Rails</a>, Dynamic Data makes a high use of conventions to infer how the results will be rendered, but it can be highly customized in an really easy way by adding metadata to the model or modifying/adding templates. This allows to start with a raw prototype and continue customizing and tuning it &#8217;till a mature application.</p>
<h2>Getting Started</h2>
<p>Once you got the <a href="http://www.asp.net/dynamicdata/" target="_blank">bits</a> installed, you are able to create a new project using one of these two templates:</p>
<ul>
<li><strong>Dynamic Data Web Application</strong>: Creates a Dynamic Data web application using a <strong><a href="http://msdn.microsoft.com/en-us/library/bb386976.aspx" target="_blank">LINQ to SQL</a></strong> data model to generate the scaffolds.</li>
<li><strong>Dynamic Data Entities Web Application</strong>: Creates a Dynamic Data web application using a <strong>Entity Data Model</strong> (<a href="http://msdn.microsoft.com/en-us/library/bb399572.aspx" target="_blank">ADO.NET Entity Framework</a>) to generate the scaffolds.</li>
</ul>
<p>The main difference between both, is the data model that Dynamic Data will use as data source and to infer the metadata needed to do the scaffolding.</p>
<h3>The Data Model</h3>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/08/image1.png"><img src="http://blogs.southworks.net/jcisneros/files/2008/08/image-thumb.png" border="0" alt="image" width="134" height="244" align="left" /></a> As said before, the data model can be LINQ to SQL or Entity Data Model depending on the project type selected.</p>
<p>While LINQ to SQL is tightly bound to the database schema (each property is bound to a specific field in a table), Entity Framework is more flexible and loosely coupled and you can query for entities using either <a href="http://msdn.microsoft.com/en-us/library/bb308959.aspx" target="_blank">LINQ</a> or <a href="http://msdn.microsoft.com/en-us/library/bb387145.aspx" target="_blank">Entity-SQL</a>.</p>
<p>When creating the data model is recommendable to create a <strong>Model</strong> folder to place the data model file (<strong>.dbml</strong> or <strong>.edmx</strong>) and the additional classes that we will create through the development to enhance the metadata.</p>
<h3>Enabling Scaffolding</h3>
<p>This is the easiest thing, to enable the scaffolding you just need to modify a simple line of code.</p>
<p>In the <strong>global.asax.cs</strong> file is a method named <strong>RegisterRoutes</strong> where you will find a big section of commented description on how to register a data context to be used as the model to generate the scaffolds.</p>
<p>To enable scaffolding for all the classes/tables in the data model, you need to register the model in this way: (un-comment the following line and modify the <strong>bold</strong> parts)</p>
<blockquote><p>model.RegisterContext(typeof(Model.<strong>MyDataModelContext</strong>), new ContextConfiguration() { ScaffoldAllTables = <strong>true</strong> });</p></blockquote>
<p>Just modifying the previous line your application is ready to run, just press F5 and enjoy the magic!</p>
<p>If you want to generate scaffolds for specific classes/tables you have to set the <strong>ScaffoldAllTables</strong> property to <strong>false</strong> and then decorate the classes you want to scaffold with the <strong>[Scaffold(true)]</strong> attribute.</p>
<p><img src="http://blogs.southworks.net/jcisneros/files/2008/08/image2.png" border="0" alt="image" width="470" height="398" /></p>
<h3>Adding Metadata</h3>
<p>The generated scaffolds have all the common functions of a data-driven application, the list are filtered, sorted and paged, the fields in the edit and insert forms are validated according to its data types, etc., but it only does the best it can with all the metadata that can retrieve from the data model, therefore you will find that many things that can be improved or refined.</p>
<p>To add metadata to the model, Dynamic Data provides a full set of attributes under the <strong>System.ComponentModel.DataAnnotations</strong> namespace to be applied to the classes in the data model. But instead of applying the attributes directly over the generated code of the model you have to create partial classes aimed just to add metadata to the model.</p>
<p>Here, we&#8217;ll face a problem since a partial class can not redefine a property, thus we won&#8217;t be able to add metadata to the properties. This problem is solved by using an inner class and associating it to the data model class with the <strong>MetadataType</strong> attribute.</p>
<p>The following is a sample of a data model class using an inner class to refine the model:</p>
<blockquote><p><strong>[MetadataType(typeof(ProductMetadata))] </strong><br />
public partial class Product<br />
{<br />
private class ProductMetadata<br />
{<br />
<strong>[StringLength(30)]<br />
[Required(ErrorMessage = "Product name is required.")]<br />
[DisplayName("Product Name")] </strong><br />
public object Name { get; set; }</p>
<p><strong>[Range(0, 10000, ErrorMessage = "Standard Cost should be between {1} and {2}.")] </strong><br />
public object Price { get; set; }<br />
}<br />
}</p></blockquote>
<p>Since the inner class porpoise is to add meta data, the properties only need to match in name and not in type (in the sample, all the properties are of object type).</p>
<p>In this post by <a href="http://blogs.msdn.com/mairaw/default.aspx" target="_blank">María Wenzel</a> you will find a list with some of the attributes available: <a href="http://blogs.msdn.com/mairaw/archive/2008/04/24/dynamic-data-attributes.aspx" target="_blank">Dynamic Data Attributes</a>.</p>
<h3>Customizing the Templates</h3>
<p>Under the folder <strong>DynamicData</strong> you will find all the templates that Dynamic Data uses to generate the scaffolds. You can modify them to change the look and feel, or to add new functions for all the tables, but if you want to customize the templates for an specific table, you can, just follow these simple steps:<a href="http://blogs.southworks.net/jcisneros/files/2008/08/image3.png"><img src="http://blogs.southworks.net/jcisneros/files/2008/08/image-thumb1.png" border="0" alt="image" width="137" height="244" align="right" /></a></p>
<ol>
<li>Create a new folder with the name of the table you want to customize under the <strong>DynamicData\CustomPages</strong>.</li>
<li>Copy from <strong>DynamicData\PageTemplates</strong> the <strong>aspx</strong> templates you want to customize (i.e. <em>List.aspx</em>) and paste in the new folder.</li>
<li>Delete the code behind file of the new template (i.e. <em>List.aspx.cs</em> and <em>List.aspx.designer.cs</em>).</li>
<li>Customize the new template at your desire and using all of your creativity.</li>
</ol>
<p>Notice the use of conventions in this case that allows a friendly development experience. Dynamic Data will look for the templates, first under <strong>DynamicData\CustomPages\[TableToRender]</strong> and then under <strong>DynamicData\PageTemplates</strong>.</p>
<h2>Conclusions</h2>
<p>With ASP.NET Dynamic Data you can experience a nice development experience, it is easy to learn and to use. Some people may say that scaffolding is just for prototyping, I agree on that, but I found Dynamic Data very flexible and customizable, you may use it for a part of the application (where only CRUD operations are needed) and, for the rest of the application, continue developing as you are used to. Something that I noticed is a little of lack of performance, I think that it is caused by the use of reflection to get the metadata from the model. Anyway, it is a very interesting and nice framework that worth the try.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/08/05/aspnet-dynamic-data-scaffolding-with-net/feed/</wfw:commentRss>
		</item>
		<item>
		<title>.NET Framework 3.5 SP1 - Client Profile</title>
		<link>http://blogs.southworks.net/jcisneros/2008/07/25/net-framework-35-sp1-client-profile/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/07/25/net-framework-35-sp1-client-profile/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 11:47:11 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[SP1]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jcisneros/?p=30</guid>
		<description><![CDATA[The .NET Framework 3.5 Client Profile is a lightweight subset of the full .NET Framework 3.5 aimed to be deployed in Client machines. Therefore, it only have the assemblies that are commonly used on client boxes and does not contains any server or development related assemblies.
This framework subset weight just 27Mb against the 200Mb of [...]]]></description>
			<content:encoded><![CDATA[<p>The .NET Framework 3.5 Client Profile is a lightweight subset of the full .NET Framework 3.5 aimed to be deployed in Client machines. Therefore, it only have the assemblies that are commonly used on client boxes and does not contains any server or development related assemblies.</p>
<p>This framework subset weight just 27Mb against the 200Mb of the full framework.</p>
<p>You can get the bits from here: <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=4F7AE6FE-F4D1-4196-A372-80EAB6D56332&amp;displaylang=en">Microsoft .NET Framework 3.5 Client Profile (BETA)</a></p>
<h3>How do you ensure your project will work for the .Net Framework Client Profile?</h3>
<p>It&#8217;s pretty easy, if you have installed the <a href="http://msdn.microsoft.com/en-us/vstudio/cc533448.aspx">Visual Studio 2008 SP1</a> in the project properties you will find a checkbox that allows to target your application to the Client Profile subset.</p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/07/image.png"><img src="http://blogs.southworks.net/jcisneros/files/2008/07/image-thumb.png" border="0" alt="image" width="244" height="98" /></a></p>
<p>Visual Studio will verify all the references and will add an exclamation icon on the references that are not available for the client subset, also when building the project, warnings will be displayed for the unavailable assemblies.</p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/07/image1.png"><img src="http://blogs.southworks.net/jcisneros/files/2008/07/image-thumb1.png" border="0" alt="image" width="209" height="244" /></a></p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/07/image2.png"><img src="http://blogs.southworks.net/jcisneros/files/2008/07/image-thumb2.png" border="0" alt="image" width="244" height="59" /></a></p>
<p>If you got the beta version of the Visual Studio SP1 you have to take in mind that the subset list (Client.xml) that Visual Studio uses to validate the references is out of synch from the actually included assemblies (VS generate warnings for some assemblies that really are in the Client Profile). To solve this issue, you may find useful the Justin Van Patten&#8217;s blog post: <a href="http://blogs.msdn.com/bclteam/archive/2008/05/21/net-framework-client-profile-justin-van-patten.aspx">.NET Framework Client Profile</a>.</p>
<p><a href="http://technorati.com/claim/dfupkzeefw" rel="me">Technorati Profile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/07/25/net-framework-35-sp1-client-profile/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C# 3.0 new features</title>
		<link>http://blogs.southworks.net/jcisneros/2008/07/24/c-30-new-features/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/07/24/c-30-new-features/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 14:42:31 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jcisneros/2008/07/24/c-30-new-features/</guid>
		<description><![CDATA[This post is aimed to be a quick abstract for all the new C# language constructs introduced with the version 3.0.
Implicitly typed local variables
By using var keyword to define a local (does not work at class level) variable is not needed to define its type, the compiler will infer it.
Examples:
var i = 0;   [...]]]></description>
			<content:encoded><![CDATA[<p>This post is aimed to be a quick abstract for all the new C# language constructs introduced with the version 3.0.</p>
<h2>Implicitly typed local variables</h2>
<p>By using <strong>var</strong> keyword to define a local (does not work at class level) variable is not needed to define its type, the compiler will infer it.</p>
<p><strong>Examples:</strong></p>
<p>var i = 0;    <br />var intArr = new[] { 0, 1, 2, 3 };</p>
<h2>Object and Collection Initializers</h2>
<p>Object&#8217;s properties can be initialized when creating the object and also the collection items.</p>
<p><strong>Examples:</strong></p>
<p>TextBox txt = new TextBox() { Text = &quot;John&quot;, Width = 200 };</p>
<p>List&lt;string&gt; colorspaces = new List&lt;string&gt; {&quot;RGB&quot;, &quot;CMYK&quot;, &quot;GreyScale&quot;, &quot;B/W&quot;};</p>
<h2>Anonymous types</h2>
<p>By combining the previous two features (<strong>Implicitly typed variables</strong> and <strong>Object initializers</strong>) you can create anonymous types (statically typed, with no name used in the code).</p>
<p><strong>Example:</strong></p>
<p>var guy = new { FirstName = &quot;John&quot;, LastName = &quot;Doe&quot; };    <br />Console.WriteLine(guy.FirstName);</p>
<h2>Automatically Implemented Properties</h2>
<p>You can create properties with no need for a private member to store its value.</p>
<p><strong>Examples:</strong></p>
<p>public string Name { get; set; } </p>
<p>//read-only property    <br />public byte Age { get; private set; }</p>
<h2>Extension methods</h2>
<p>By using the <strong>this</strong> keyword in a static method argument you can extend another class. You &quot;injects&quot; methods to an existing class from another one.</p>
<p><strong>Example:</strong></p>
<p>public static class ExtensionClass    <br />{     <br />&#160;&#160;&#160; //Extension method     <br />&#160;&#160;&#160; public static byte ToGray(<strong>this</strong> <strong>Color</strong> c)     <br />&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return (byte)(0.3 * c.R + 0.59 * c.G + 0.11 * c.B);     <br />&#160;&#160;&#160; }     <br />}</p>
<p>byte pixelGray = Color.Green.ToGray();</p>
<h2>Lambda Expressions</h2>
<p>Lambda expressions are like pretty simple functions that takes input parameters and evaluates an expression.</p>
<p><strong>Syntax:</strong></p>
<pre>(input parameters) =&gt; expression</pre>
<p><strong>Examples:</strong></p>
<p>int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };<br />
  <br />int oddNumbers = numbers.Count(n =&gt; n % 2 == 1); </p>
<p>Console.WriteLine(oddNumbers.ToString()); </p>
<p>Func&lt;int, int&gt; duplicate = number =&gt; number * 2;<br />
  <br />Console.WriteLine(duplicate.Invoke(2).ToString());</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/07/24/c-30-new-features/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AOP with PostSharp</title>
		<link>http://blogs.southworks.net/jcisneros/2008/06/22/aop-with-postsharp/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/06/22/aop-with-postsharp/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 04:49:58 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[AOP]]></category>

		<category><![CDATA[PostSharp]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jcisneros/?p=11</guid>
		<description><![CDATA[PostSharp is a great open-source tool that allows you to encapsulate the non-business logic in custom attributes. That&#8217;s the Aspect Oriented Programming paradigm main goal: the separation of concerns.
This tool heps you to free the business logic from the infrastructure code such as:

Transactions
Logging
Permissions / Security
Exceptions handling
Caching
Settings

Your code will be cleaner than never.
&#8230;and why do I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.postsharp.org/" target="_blank">PostSharp</a> is a great open-source tool that allows you to encapsulate the non-business logic in custom attributes. That&#8217;s the <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming" target="_blank">Aspect Oriented Programming</a> paradigm main goal: the separation of concerns.</p>
<p>This tool heps you to free the business logic from the infrastructure code such as:</p>
<ul>
<li>Transactions</li>
<li>Logging</li>
<li>Permissions / Security</li>
<li>Exceptions handling</li>
<li>Caching</li>
<li>Settings</li>
</ul>
<p>Your code will be cleaner than never.</p>
<p>&#8230;and why do I call it a &#8220;great tool&#8221;? Because, unlike other tools that uses reflection and other techniques that reduces performance, PostSharp works at <a href="http://en.wikipedia.org/wiki/Common_Intermediate_Language" target="_blank">MSIL</a> level!. It generates MSIL code to be injected in your code at compilation time, in that way it supports any .NET language and get the best performance possible.</p>
<p>Furthermore, this tool is really easy to learn. You can quickly get started by using the basic features, follow this simple quick start:</p>
<ul>
<li><strong><a href="http://www.postsharp.org/about/getting-started/">PostSharp - QuickStart</a></strong></li>
</ul>
<p>The following example shows a simple PostSharp aspect to trace the execution of the methods marked with that attribute:</p>
<p><span style="color: #0000ff">public</span> <span style="color: #0000ff"> class</span> <span style="color: #2b91af">SimplestTraceAttribute</span> : <span style="color: #2b91af">OnMethodBoundaryAspect<br />
</span>{<span style="color: #0000ff"><br />
public</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff"> void</span> OnEntry( <span style="color: #2b91af">MethodExecutionEventArgs</span> eventArgs)<span style="font-size: small"> </span><br />
{<span style="color: #2b91af"><br />
Trace</span>.TraceInformation(<span style="color: #a31515">&#8220;Entering  					{0}.&#8221;</span>, eventArgs.Method);<span style="color: #2b91af"><br />
Trace</span>.Indent();<br />
}  <span style="color: #0000ff"><br />
public</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff"> void</span> OnExit( <span style="color: #2b91af">MethodExecutionEventArgs</span> eventArgs)<br />
{<span style="color: #2b91af"><br />
Trace</span>.Unindent();<span style="color: #2b91af"><br />
Trace</span>.TraceInformation(<span style="color: #a31515">&#8220;Leaving  					{0}.&#8221;</span>, eventArgs.Method);<br />
}<br />
}</p>
<p>&#8230;and it works like a charm!</p>
<p><strong>The evidence:</strong></p>
<p><em>Building the project:</em></p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/06/postsharp_build.jpg"><img class="alignnone size-medium wp-image-20" src="http://blogs.southworks.net/jcisneros/files/2008/06/postsharp_build.jpg" alt="" width="300" height="99" /></a></p>
<p><em>Inspecting the binaries:</em></p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/06/postsharp_reflector.jpg"><img class="alignnone size-medium wp-image-19" src="http://blogs.southworks.net/jcisneros/files/2008/06/postsharp_reflector.jpg" alt="" width="300" height="208" /></a></p>
<p><em>Results:</em></p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/06/postsharp_output.jpg"><img class="alignnone size-medium wp-image-21" src="http://blogs.southworks.net/jcisneros/files/2008/06/postsharp_output.jpg" alt="" width="300" height="108" /></a></p>
<h2>Resources:</h2>
<ul>
<li><a href="http://www.postsharp.org/" target="_blank">PostSharp Official WebSite</a> (see <a href="http://www.postsharp.org/about/" target="_blank">About PostSharp</a>)</li>
<li><a href="http://code.google.com/p/postsharp-user-samples/" target="_blank">Visual Basic PostSharp Samples</a></li>
</ul>
<p>Enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/06/22/aop-with-postsharp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Managed Add-In Framework</title>
		<link>http://blogs.southworks.net/jcisneros/2008/06/16/managed-add-in-framework/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/06/16/managed-add-in-framework/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 21:05:32 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[AddIn]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jcisneros/?p=9</guid>
		<description><![CDATA[In this post I will describe the basics of MAF to quickly introduce this framework.
The Managed Add-In Framework is an Add-In architecture built on top of the .Net Framework aimed to address the following problems:

Loading/Unloading
Sandboxing (Add-ins can be sandboxed to a particular security permission set)
Isolation (isolation boundary between the Host and the Add-ins)
Lifetime Management
Discovery
Activation
Backwards compatibility
Forwards [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I will describe the basics of MAF to quickly introduce this framework.</p>
<p>The Managed Add-In Framework is an Add-In architecture built on top of the .Net Framework aimed to address the following problems:</p>
<ul>
<li>Loading/Unloading</li>
<li>Sandboxing (Add-ins can be sandboxed to a particular security permission set)</li>
<li>Isolation (isolation boundary between the Host and the Add-ins)</li>
<li>Lifetime Management</li>
<li>Discovery</li>
<li>Activation</li>
<li>Backwards compatibility</li>
<li>Forwards compatibility</li>
<li>Isolation changes (moving from AppDomain to Process isolation boundaries)</li>
<li>Sharing (taking an add-in built for one application and running it in another)</li>
</ul>
<p>A MAF solution usually have seven types of projects:</p>
<ul>
<li><strong>Host:<strong> </strong></strong>The main application that supports extensibility and manages the add-ins.</li>
<li><strong>Host View:</strong> Defines the functionalities that the host expects from the add-ins. The host will work against this view directly.</li>
<li><strong>Host Side Adapter: </strong>This is the glue between the Host View and the Contract. It has adapter classes that are used to convert to and from the host views and the contracts.</li>
<li><strong>Contract:</strong> The interfaces used to communicate between Host and Add-Ins.</li>
<li><strong>Add-In Side Adapter:</strong> This is the glue between the Add-In View and the Contract. It has adapter classes that are used to convert to and from the Add-In views and the contracts.</li>
<li><strong>Add-In View:</strong> Represents the Add-In view of the methods and object types used to communicate with the host.</li>
<li><strong>Add-In:</strong> An assembly loaded by the host to extend functionalities.</li>
</ul>
<p>For more details about contracts and adapters go to this post: <a href="http://blogs.msdn.com/jackg/archive/2005/09/15/468068.aspx">PDC05 - Managed AddIn Framework (MAF)</a></p>
<p>As you can deduce from the next picture the Host only references to the Host View and the Add-In only references to the Add-In view, so, each part hast its own view of the contract. In this way, if there is a new contract, it&#8217;s just necessary create new adapters to allow forward and backward compatibility.</p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/06/maf.png"><img class="alignnone size-medium wp-image-10" src="http://blogs.southworks.net/jcisneros/files/2008/06/maf.png" alt="" width="300" height="60" /></a><br />
If you are thinking that it is too much effort to create so many projects I have good news for you, there is an Add-In for Visual Studio that generates the Add-In View, Add-In Adapter, Host View and the Host Adapter from the Contract project. You can find the add-in here: <a href="http://www.codeplex.com/clraddins/Wiki/View.aspx?title=Pipeline%20Builder&amp;referringTitle=Home">Pipeline Builder</a>.</p>
<h2>Creating a contract</h2>
<p>The first step to create a extensible host is to define a Contract. To do this you have to create a project with an Interface to define the functionalities that the host will expect from the add-ins. This interface have to derive from IContract and have to be marked with the AddInContract attribute. This is an example of an Contract:<br />
<code>using System;<br />
using System.AddIn.Pipeline;<br />
using System.AddIn.Contract;<br />
<br />
namespace Contracts<br />
{<br />
&nbsp;&nbsp;[AddInContract]<br />
&nbsp;&nbsp;public interface IHelloMAFContract : IContract<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;string SayHelloMAF();<br />
&nbsp;&nbsp;}<br />
}<br />
</code><br />
Then you can generate the basic Adapters and Views for the Host and Add-Ins using the  <a href="http://www.codeplex.com/clraddins/Wiki/View.aspx?title=Pipeline%20Builder&amp;referringTitle=Home">Pipeline Builder</a>.</p>
<p>The projects in a MAF solution should follow a defined file structure, for the Contract project, a possible output directory can be: &#8220;..\output\Contracts\&#8221;. You can find more details about the directory requirements in this topic: <a href="http://msdn.microsoft.com/en-us/library/bb384240.aspx" target="_blank">Pipeline Development Requirements</a>.</p>
<h2>Creating an Add-In</h2>
<p>To create an Add-In, you just have to create a project with a class implementing the contract from the AddInView project and marked with the AddIn attribute. The following is an example AddIn implementation:<br />
<code>using System;<br />
using System.AddIn;<br />
using Contracts.AddInViews;<br />
<br />
namespace AddInV1<br />
{<br />
&nbsp;&nbsp;[AddIn("AddInV1", Version="1.0.0.0")]<br />
&nbsp;&nbsp;public class AddInV1 : IHelloMAF<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;public string SayHelloMAF()<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return &#8220;Hello MAF!!&#8221;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;}<br />
}<br />
</code><br />
This project may be generated in the directory &#8220;..\Output\AddIns\AddInName\&#8221;.</p>
<h2>Discovering and activating the Add-Ins</h2>
<p>To discover the available Add-Ins the host can obtain a list of tokens that represents all the available Add-Ins of a specific type in a specific location. These tokens contains the Add-Ins information such as name and version, with that information then the host can decide which Add-Ins activate.</p>
<p>This is a sample code snippet for discovering and activating add ins:<br />
<code>static void Main()<br />
{<br />
&nbsp;&nbsp;// In this sample we expect the AddIns and components to<br />
&nbsp;&nbsp;// be installed in the current directory<br />
&nbsp;&nbsp;String addInRoot = Environment.CurrentDirectory;<br />
<br />
&nbsp;&nbsp;// Check to see if new AddIns have been installed<br />
&nbsp;&nbsp;AddInStore.Rebuild(addInRoot);<br />
<br />
&nbsp;&nbsp;// Look for Calculator AddIns in our root directory and<br />
&nbsp;&nbsp;// store the results<br />
&nbsp;&nbsp;Collection tokens =<br />
&nbsp;&nbsp;AddInStore.FindAddIns(typeof(Calculator), addInRoot);<br />
<br />
&nbsp;&nbsp;// Ask the user which AddIn they would like to use<br />
&nbsp;&nbsp;AddInToken calcToken = ChooseCalculator(tokens);<br />
<br />
&nbsp;&nbsp;// Activate the selected AddInToken in a new AppDomain set sandboxed<br />
&nbsp;&nbsp;// in the internet zone<br />
&nbsp;&nbsp;Calculator calculator = calcToken.Activate(AddInSecurityLevel.Internet);<br />
<br />
&nbsp;&nbsp;// Run the read-eval-print loop<br />
&nbsp;&nbsp;RunCalculator(calculator);<br />
}<br />
</code></p>
<h2>Further readings</h2>
<ul>
<li><a href="http://channel9.msdn.com/posts/DanielMoth/Managed-AddIn-Framework/" target="_blank">Channel 9 - Managed AddIn Framework, by Daniel Moth<br />
</a>(I highly recommend this video)</li>
<li><a title="CLR Add-In Team Blog" href="http://blogs.msdn.com/clraddins/default.aspx" target="_blank">CLR Add-In Team Blog</a></li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/cc163476.aspx" target="_blank">CLR Inside Out - .NET Application Extensibility</a></li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/cc163460.aspx" target="_blank">CLR Inside Out - .NET Application Extensibility, Part 2</a></li>
<li><a href="http://cskardon.wordpress.com/2008/04/08/managed-application-framework-part-1-the-beginnings/" target="_blank">Managed Application Framework - Part 1 - The Beginnings!</a> (this post has a quick MAF example)</li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb384241.aspx" target="_blank">AddIn and Extensibility on MSDN</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/06/16/managed-add-in-framework/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Enterprise Library 4.0 just released!</title>
		<link>http://blogs.southworks.net/jcisneros/2008/05/17/enterprise-library-40-just-released/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/05/17/enterprise-library-40-just-released/#comments</comments>
		<pubDate>Sat, 17 May 2008 01:51:00 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[Enterprise Library]]></category>

		<category><![CDATA[Patterns &amp; Practices]]></category>

		<category><![CDATA[SCSF]]></category>

		<category><![CDATA[WCSF]]></category>

		<guid isPermaLink="false">/blogs/jcisneros/archive/2008/05/16/Enterprise-Library-4.0-just-released_2100_.aspx</guid>
		<description><![CDATA[The Enterprise Library 4.0 (May 2008) final release is now available to download. These are some of the new features in this version:

Visual Studio 2008 support
Integration with Unity
Windows Management Instrumentation (WMI) 2.0 support and improved instrumentation
Pluggable Cache Managers
Performance improvements
Bug fixes
&#8230;and more

You can find more details about this release in Grigori&#39;s blog.
In addition, we have just [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://msdn.microsoft.com/en-us/library/cc512464.aspx" title="Enterprise Library 4 MSDN Landing Page" target="_blank">Enterprise Library 4.0 (May 2008)</a> final release is now available to <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=90DE37E0-7B42-4044-99BE-F8ECFBBC5B65&amp;displaylang=en" title="donwload Enterprise Library 4" target="_blank">download</a>. These are some of the new features in this version:</p>
<ul>
<li>Visual Studio 2008 support</li>
<li>Integration with Unity</li>
<li>Windows Management Instrumentation (WMI) 2.0 support and improved instrumentation</li>
<li>Pluggable Cache Managers</li>
<li>Performance improvements</li>
<li>Bug fixes</li>
<li><a href="http://msdn.microsoft.com/en-us/library/cc511712.aspx" title="What&#39;s new" target="_blank">&#8230;and more</a></li>
</ul>
<p>You can find more details about this release in <a href="http://blogs.msdn.com/agile/archive/2008/05/16/enterprise-library-4-0-for-visual-studio-2008-released.aspx" title="Official release notice" target="_blank">Grigori&#39;s blog</a>.</p>
<p>In addition, we have just published two How-To documents in the <a href="http://www.codeplex.com/websf" title="WCSF at CodePlex" target="_blank">Web Clist Software Factory</a> and <a href="http://www.codeplex.com/smartclient" title="SCSF at CodePlex" target="_blank">Smart Client Software Factory</a> websites that describes the steps required to update existing WCSF/SCSF solutions and create custom Guidance Packages to use the Enterprise Library 4.</p>
<p>You can find them here:</p>
<ul>
<li><a href="http://www.codeplex.com/websf/Wiki/View.aspx?title=HowTo%20WCSF%20EntLib4&amp;referringTitle=Others" title="WCSF + EntLib4" target="_blank">How To: Use <span style="font-weight: bold">WC-SF</span> with <span style="font-weight: bold">Enterprise Library 4</span></a></li>
<li><a href="http://www.codeplex.com/smartclient/Wiki/View.aspx?title=HowTo%20SC-SF%20EntLib4&amp;referringTitle=Others" title="SCSF + EntLib4" target="_blank">How To: Use <span style="font-weight: bold">SC-SF</span> with <span style="font-weight: bold">Enterprise Library 4</span></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/05/17/enterprise-library-40-just-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Smart Client Software Factory</title>
		<link>http://blogs.southworks.net/jcisneros/2008/04/01/smart-client-software-factory/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/04/01/smart-client-software-factory/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 16:30:00 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[CAB]]></category>

		<category><![CDATA[Patterns &amp; Practices]]></category>

		<category><![CDATA[SCSF]]></category>

		<guid isPermaLink="false">/blogs/jcisneros/archive/2008/04/01/Smart-Client-Software-Factory.aspx</guid>
		<description><![CDATA[Continuando con el artículo de introducción a CAB, en este post voy a explicar los conceptos básicos de Smart Client Software Factory (SCSF), el proyecto que nos permite automatizar el desarrollo de aplicaciones compuestas usando CAB.
Si ya estuvieron haciendo pruebas con CAB se habrán dado cuenta de que se requiere mucho trabajo extra para crear [...]]]></description>
			<content:encoded><![CDATA[<p>Continuando con el artículo de introducción a CAB, en este post voy a explicar los conceptos básicos de <a href="http://www.codeplex.com/smartclient">Smart Client Software Factory</a> (SCSF), el proyecto que nos permite automatizar el desarrollo de aplicaciones compuestas usando CAB.</p>
<p>Si ya estuvieron haciendo pruebas con CAB se habrán dado cuenta de que se requiere mucho trabajo extra para crear los nuevos elementos como ser, Workitems, Presenters, Controllers, publicaciones y subscripciones a eventos y comandos, etc.. SCSF nos ofrece un conjunto de asistentes (<strong>recipes</strong>) y guías que nos ayudan a crear estos elementos en forma automatizada y empleando un diseño adecuado.</p>
<p>Básicamente, SCSF es un agregado para el Visual Studio que añade nuevos tipos de proyectos y asistentes para la creación automatizada de los elementos nombrados. SCSF también posee proyectos de ejemplos (Hands on Labs y Quickstarts) y documentación que nos guían en el aprendizaje e implementación de aplicaciones SCSF.</p>
<p>Si en este artículo encuentra alguna palabra que desconoce es probable que encuentre su definición en el Glosario de CAB en mi post anterior de <a href="/blogs/jcisneros/archive/2008/02/13/Yet-Another-Post-about-CAB.aspx">Introducción a Composite UI Application Block</a>.</p>
<h2>¿Qué nos ofrece SCSF?</h2>
<p>Con SCSF se obtienen todos los beneficios del desarrollo de aplicaciones con CAB, y además:</p>
<ul type="disc">
<li>Automatización de varias tareas del desarrollo de una aplicación CAB/SCSF.</li>
<li>Guías para las tareas que no pueden ser automatizadas.</li>
<li>Nuevos elementos que añaden y extienden las funcionalidades originales de CAB (ej. Entity Translator, Disconnected Service Agent, Action Catalog).</li>
<li>Ejemplos, documentación y muchos recursos para el aprendizaje.</li>
<li>Excelente soporte en el foro del proyecto en <a title="Foro SCSF" href="http://www.codeplex.com/smartclient/Thread/List.aspx" target="_blank">CodePlex</a>.</li>
</ul>
<h2>Nuevos elementos</h2>
<p>Los proyectos que sean creados usando SCSF poseen en la misma solución un conjunto de clases que añaden nuevas funciones o que encapsulan los elementos originales de CAB. Los nuevos elementos y conceptos que se deben de tener en cuenta en SCSF son:</p>
<p style="margin-left: 40px"><span style="font-style: italic">Nota: Es importante tener en cuenta que la siguiente lista es sólo de algunos de los conceptos más importantes introducidos por SCSF y por lo tanto deja de lado muchos conceptos de CAB que son de vital importancia y que requieren ser abordados previamente para un correcto entendimiento.</span></p>
<ul type="disc">
<li><strong>Recipe</strong>: un asistente en el Visual Studio que nos automatiza la creación de algún elemento de CAB/SCSF.</li>
<li><strong>WorkItemController</strong>: con SCSF en lugar de heredar nuestros WorkItems de la clase <strong>WorkItem</strong> podemos heredar de la clase abstracta <strong>WorkItemController</strong>, esta clase contiene un workitem asociado al cual podemos acceder por medio de la propiedad WorkItem. De esta forma, logramos una mejor separación de responsabilidades del WorkItem, que anteriormente actuaba como contenedor<br />
(Items, Services, WorkItems) y como lugar donde se colocaba la lógica de negocio de los casos de uso. Ahora el WorkItem sólo actúa como conteneder y nuestra clase que hereda de WorkItemController es el lugar donde colocamos la lógica de negocio.</li>
<li><strong>ControlledWorkItem</strong>: es una clase genérica (debemos indicarle un WorkItemController) que nos ayuda a instanciar nuestro WorkItem que hereda de WorkItemController.</li>
<li><strong>Business Module</strong>: es un proyecto (DLL) que contiene una unidad del negocio junto con sus vistas (ej. Módulos Clientes, Stock, Administración, etc.). Cada Business Module tienen un WorkItemController principal llamado <strong>ModuleController</strong>.</li>
<li><strong>ModuleController</strong>: es una clase que hereda de WorkItemController que toma el papel de WorkItem raíz para el módulo de negocio. En esta clase es donde realizaremos gran parte de las<br />
tareas de inicialización del módulo (agregar vistas, añadir ítems a los extension sites, registrar servicios, etc.).</li>
<li><strong>Fundational Module</strong>: al igual que un Business Module, es una DLL pero generalmente no poseen vistas y no tienen WorkItems. Se emplean, principalmente, para contener servicios globales que utilizan otros módulos (ej. Módulo Logging, Seguridad, Acceso a Datos, etc.). Todos los módulos (tanto fundational como business) tienen una clase <strong>Module</strong> que hereda <strong>ModuleInit</strong> con un método <strong>Load</strong> para que puedan ser cargados por CAB.</li>
<li><strong>Action Catalog</strong>: servicio de SCSF que implementa un patrón que permite ejecutar acciones basado en condiciones que cambian en tiempo de ejecución.</li>
<li><strong>Disconected Service Agent</strong>: SCSF provee un recipe para crear disconnected service agents (DSA).  DSA es un servicio que permite abstraer un servicio web para poder usarlo en forma desconectada cuando el servicio no está disponible.</li>
<li><strong>Entity Translator</strong>: servicio de SCSF que permite transformar una entidad de negocio a otro tipo de entidad requerida por servicios externos.</li>
</ul>
<h2>Solución inicial</h2>
<p>Cuando creamos un proyecto de SCSF, este nos crea una solución con varios proyectos listos para funcionar que se encuentran organizados en un conjunto de carpetas. Los proyectos iniciales que se<br />
encuentran en la carpeta <strong>Infrastructure </strong>son proyectos básicos para el funcionamiento de la aplicación y que brindan los servicios sobre los que se construyen los demás módulos que componen la<br />
aplicación. Dependiendo de la configuración que hayamos elegido en la recipe al momento de crear el proyecto, nuestra solución contendrá básicamente los siguientes proyectos:</p>
<ul type="disc">
<li><strong>Infrastructure.Interface</strong>: contiene elementos globales que necesitan ser expuestos a los módulos de la aplicación como ser: interfaces de los servicios de infraestructura, definiciones de constantes, entidades de negocio que necesitan ser pasadas entre varios módulos, etc.</li>
<li><strong>Infrastructure.Library</strong>: contiene las implementaciones de los elementos comunes para todas las aplicaciones SCSF como ser los servicios de trasformación de entidades, del DSA, carga<br />
del ProfileCatalog desde un Web service, etc.</li>
<li><strong>Infrastructure.Module</strong>: es un business module vacío que podemos usar para la implementación de cualquier elemento que necesita ser compartido por varios módulos de la aplicación.</li>
<li><strong>Shell</strong>: al igual que una aplicación CAB, es el proyecto inicial que tiene el ProfileCatalog.xml para cargar los módulos y crea el WorkItem raíz y contiene el formulario Shell que posee la interfaz básica con los Workspaces para desplegar las vistas.</li>
<li><strong>Infrastructure.Layout</strong>: es un módulo que contiene una vista en la que se diseña la interfaz común<br />
dejando a la shell prácticamente vacía, logrando una mejor separación de responsabilidades y facilitando el reemplazo y reutilización de la interfaz común de la aplicación. Este proyecto se crea sólo si se tildó la opción para crear un módulo separado para el layout del shell.</li>
</ul>
<p>Los siguientes pasos, una vez que ya tenemos la solución para comenzar a trabajar, son:</p>
<ol type="1">
<li>Modificar la Shell si la interfaz por default no es lo que necesitamos.</li>
<li>Crear los módulos fundacionales que expondrán servicios para el resto de la aplicación.</li>
<li>Crear los módulos de negocio, las vistas y demás elementos necesarios.</li>
</ol>
<p>Si empleamos TDD, luego de crear cada módulo y antes de seguir con la implementación del módulo, debemos crear las pruebas y seguir con el proceso del desarrollo dirigido por pruebas.</p>
<p>Todas estas tareas pueden hacerse en forma automatizada usando las <strong>recipes</strong> que nos ofrece SCSF.</p>
<h2>¿Cómo se hace en SCSF?</h2>
<p>Una situación común en la gente que empieza con SCSF es preguntarse cuál es la forma en que se hace determinada cosa en SCSF, o dónde tengo que poner tal cosa o cuál es la forma correcta de hacer tal otra cosa. Ésta desorientación en los principiantes se puede deber a la gran cantidad de guías y lineamientos que ofrece SCSF para hacer las cosas, dando la sensación que en SCSF existe una forma específica de hacer cada tarea para que funcione.</p>
<p>En realidad, SCSF y CAB son una extensión de funcionalidades que nos ayuda a crear mejores aplicaciones siguiendo una limitada selección de prácticas recomendadas, pero no pretende ser la solución perfecta para todas las situaciones posibles.</p>
<p>En una aplicación SCSF se pueden implementar una cosa de mil formas distintas o como lo hacemos siempre en cualquier aplicación y va a funcionar sin demasiados problemas. SCSF sólo nos facilita realizar una limitada cantidad de tareas en una forma organizada.</p>
<p>Sin embargo, cuando somos ajenos a los patrones y prácticas que se utilizan en CAB/SCSF podemos seguir sin saberlo caminos que nos pueden llevar a encontrarnos con dificultados. A continuación sugiero algunos tips que considero pueden ayudar en esta toma de decisiones:</p>
<ul type="disc">
<li>Utilizar un módulo separado para el <strong>layout </strong>cuando tengamos mucha lógica de presentación para la interfaz común que no queremos mezclar con las demás responsabilidades del proyecto Shell (el<br />
proyecto Interface.Layout tiene un ModuleController y el Shell no), o cuando queremos reutilizar la interfaz común o poder &#8220;switchearla&#8221; dinámicamente (ej. según preferencias del usuario).</li>
<li>Las <strong>vistas</strong> deberían contener el mínimo posible de lógica. La gran parte son llamadas a funciones en el presenter para informar de eventos y propiedades y eventos que el presenter usa para. El presenter contiene la lógica para manejar los eventos y actualizar la vista y el modelo.</li>
<li>Es recomendable siempre usar <strong>interfaces </strong>(principalmente en vistas y servicios) para poder intercambiar las implementaciones y facilitar el testing.</li>
<li>Usar siempre <strong>constantes</strong> para los identificadores de comandos, eventos, extensión sites, etc..</li>
<li>No usar la misma cadena para identificar un Evento y un Comando. CAB no distingue entre eventos y comandos del mismo nombre y puede traer problemas.</li>
<li>Crear un <strong>WorkItem</strong> para contener los datos o información de contexto que necesita ser comunicado a los presenters de las vistas de un módulo. Un error común es pasar información a una<br />
vista o presenter por medio de los parámetros de un evento (Event Broker), es mejor usar States.</li>
<li>Utilizar <strong>Event Broker</strong> cuando se necesita informar de eventos a toda la aplicación sin importar quién lo reciba.</li>
<li><strong>TDD</strong> es una muy buena práctica que SCSF tiene en cuenta.</li>
<li>Gran parte de la lógica de negocio, incluyendo inicializaciones, comandos, y eventos suelen quedar en los <strong>ModuleController</strong>, es muy normal.</li>
</ul>
<p>Pueden existir más recomendaciones, pero lo importante es conocer todos los elementos y herramientas que podamos tener a nuestro alcance y comprender bien cuál es el cometido de cada uno, de esta forma sabremos qué usar en cada escenario y cómo, logrando la combinación más conveniente.</p>
<h3>Lecturas recomendadas:</h3>
<ul type="disc">
<li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=5f9a8435-1651-4be2-956d-0446a89a7358&amp;displaylang=en">Designing Smart Clients Based on CAB and SCSF</a></li>
<li><a href="http://richnewman.wordpress.com/intro-to-cab-toc/">Serie de Introducción a CAB/SCSF de Richnewman</a></li>
<li><a href="http://www.codeplex.com/smartclient/Wiki/View.aspx?title=Learning%20Resources&amp;referringTitle=Home">Quick Starts y Hands on Lab en la página oficial</a></li>
<li><a href="http://www.codeplex.com/smartclient/Wiki/View.aspx?title=SCSF%20Knowledge%20Base&amp;referringTitle=Home">SCSF Knowledge Base en CodePlex</a></li>
</ul>
<p>En este post se pasaron por alto los detalles técnicos del uso de SCSF y que escapan al alcance de este post, para eso recomiendo seguir los Hands on Lab que son muy didácticos para el aprendizaje de este excelente framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/04/01/smart-client-software-factory/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creando la nueva versión de AjGenesis Studio con SCSF - I</title>
		<link>http://blogs.southworks.net/jcisneros/2008/02/28/desarrollando-ajgenesisstudio-03/</link>
		<comments>http://blogs.southworks.net/jcisneros/2008/02/28/desarrollando-ajgenesisstudio-03/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 12:21:00 +0000</pubDate>
		<dc:creator>jcisneros</dc:creator>
		
		<category><![CDATA[AjGenesis Studio]]></category>

		<category><![CDATA[SCSF]]></category>

		<guid isPermaLink="false">/blogs/jcisneros/archive/2008/02/28/Desarrollando-AjGenesisStudio-0.3.aspx</guid>
		<description><![CDATA[Con el fin de poner en pr&#225;ctica y adquirir experiencia sobre las cosas que fui aprendiendo en mi entrenamiento, me sugirieron que reescriba mi aplicaci&#243;n AjGenesisStudio usando Smart Client Software Factory, lo cual me pareci&#243; una buena idea y una oportunidad para lanzar una nueva versi&#243;n con algo m&#225;s de futuro, con esto me refiero [...]]]></description>
			<content:encoded><![CDATA[<p>Con el fin de poner en pr&#225;ctica y adquirir experiencia sobre las cosas que fui aprendiendo en mi entrenamiento, me sugirieron que reescriba mi aplicaci&#243;n <a href="http://www.codeplex.com/ajgenesisstudio">AjGenesisStudio</a> usando <a href="http://www.codeplex.com/smartclient">Smart Client Software Factory</a>, lo cual me pareci&#243; una buena idea y una oportunidad para lanzar una nueva versi&#243;n con algo m&#225;s de futuro, con esto me refiero a que la aplicaci&#243;n ser&#225; m&#225;s f&#225;cil de mantener y de a&#241;adir nuevas funcionalidades, cualquier persona que tenga alg&#250;n conocimiento de SCSF podr&#225; escribir nuevos m&#243;dulos f&#225;cilmente. </p>
<p>AjGenesisStudio es un IDE que escrib&#237; hace unos meses que sirve para trabajar con el generador de c&#243;digo de Angel Lopez: &#8220;<a href="http://www.ajlopez.com/ajgenesis/">AjGenesis</a>&#8220;, se podr&#237;a pensar como algo similar al generador &#8220;MyGeneration&#8221; pero con las ventajas que ofrece el generador AjGenesis (y sin IntelliSense por ahora).</p>
<h4>Requerimientos</h4>
<p>AjGenesisStudio es un IDE inspirado en Visual Studio por lo cual su apariencia y funciones ser&#225;n muy similares. </p>
<ul>
<li>Poder abrir y editar cualquier tipo de archivo de texto, </li>
<li>Debe permitir realizar todas las funciones de edici&#243;n de texto conocidas (copiar, pegar, buscar, reemplazar, etc.), </li>
<li>Resaltado de sintaxis para la mayor cantidad posible de archivos (XML, VB, CS, HTML. etc.), </li>
<li>Ofrecer resaltado de sintaxis en las plantillas de AjGenesis tanto para el c&#243;digo AjBasic como para el texto de salida (similar a ASP.net). </li>
<li>Poder abrir carpetas de proyectos de generaci&#243;n y mostrar los archivos en un Explorador de Proyecto en forma de &#225;rbol (similar al Explorador de Soluciones de Visual Studio). </li>
<li>Ejecutar archivos .build de NAnt con un bot&#243;n (Run). </li>
<li>Administraci&#243;n de herramientas externas (similar al de Visual Studio). </li>
<li>Poder crear nuevos archivos y proyectos a partir de plantillas (igual que VS). </li>
</ul>
<p>Para el resaltado de sintaxis y la interfaz tipo &#8220;docking&#8221; se emplea el excelente componente open source &#8220;<a href="http://www.dotnetfireball.net/">DotNetFireball</a>&#8220;.</p>
<h4>Dise&#241;o de la Shell</h4>
<p>En esta etapa ya tengo dise&#241;ado y codificado la shell y los dem&#225;s elementos y servicios de infraestructura. </p>
<p>El layout principal tiene un men&#250; principal (<strong>MainMenu</strong>) el cu&#225;l debe ser extendido usando el UIExtensionSite &#8220;<strong>MenuExtension</strong>&#8221; (los nuevos men&#250;s se insertar&#225;n entre el men&#250; View y Tools), la barra del men&#250; principal ya posee &#237;tems que son gen&#233;ricos y que todos los m&#243;dulos pueden extender (ver imagen). Luego posee una barra de herramientas (<strong>MainToolbar</strong>) y una barra de estado (<strong>MainStatus</strong>).</p>
<p><a href="http://blogs.southworks.net/jcisneros/files/2008/06/ajgsshell.png"><img height="239" alt="ajgsshell" src="http://blogs.southworks.net/jcisneros/files/2008/06/ajgsshell-thumb.png" width="416" border="0" /></a> </p>
<p>El shell tiene &#250;nicamente un Workspace: <strong>MainWorkspace</strong>, el cual es una implementaci&#243;n de IComposableWorkspace basado en el componente DockContainer de DotNetFireball. Este workspace usa un SmartPartInfo (<strong>DockableWindowSmartPartInfo</strong>) cuyo prop&#243;sito es configurar el estado de la ventana (anclado, flotante, auto-ocultable, abajo, arriba, izquierda, derecha, etc). Este workspace se encuentra en el assembly <strong>Infrastructure.UI</strong> y deber&#225; ser referenciado por los m&#243;dulos de negocio que deseen mostrar vistas. </p>
<p> El men&#250; archivo (<strong>FileMenu</strong>) puede ser extendido en 4 lugares:<a href="http://blogs.southworks.net/jcisneros/files/2008/06/filemenu.png"><img height="240" alt="filemenu" src="http://blogs.southworks.net/jcisneros/files/2008/06/filemenu-thumb.png" width="141" align="right" border="0" /></a></p>
<ul>
<li><strong>FileNewMenu</strong>: &#237;tems para crear un nuevo elemento (ej. m&#243;dulo Documento: &#8220;Nuevo Archivo&#8221;, m&#243;dulo Proyecto: &#8220;Nuevo Proyecto&#8221;). </li>
<li><strong>FileOpenMenu</strong>: &#237;tems para abrir elementos (ej. Abrir Archivo, Abrir Proyecto). </li>
<li><strong>FileAddMenu</strong>: &#237;tems que se pueden a&#241;adir a un proyecto (ej. Nuevo Xml, Nuevo Template). </li>
<li><strong>FileMenuExtension</strong>: los m&#243;dulos deben a&#241;adir &#237;tems al menu archivo a travez de este UIExtensionSite (en la imagen se ven &#237;tems a&#241;adidos por el m&#243;dulo Documento). </li>
</ul>
<h5>&#191;Por qu&#233; MenuExtension y FileMenuExtension?</h5>
<p>&#191;Por qu&#233; para extender el men&#250; principal y el men&#250; File hay que extender los elementos MenuExtension y FileMenuExtension respectivamente en lugar de extender directamente MainMenu o FileMenu? Esto ocurre porque se desea que los nuevos elementos se agreguen no al final si no en una posici&#243;n determinada (entre el men&#250; View y Tools para MainMenu y antes del Exit para FileMenu) y para lograr esto hay que usar un peque&#241;o truco que consiste en insertar al final (luego de agregar los &#237;tems b&#225;sicos) un elemento no visible al men&#250; en la posici&#243;n deseada para que luego, los siguientes elementos sean agregados en la misma posici&#243;n, pero hay que prestar atenci&#243;n al orden en que se agregan los nuevos elementos ya que ser&#225;n a&#241;adidos por encima de los anteriores (al rev&#233;s de lo normal). Pueden encontrar m&#225;s informaci&#243;n en el blog donde encontr&#233; la soluci&#243;n original: <a href="http://www.netknowledgenow.com/blogs/onmaterialize/archive/2006/08/30/Workaround-for-Injecting-menu-items-into-CAB-Shell-MenuStrip.aspx">Workaround for Injecting menu items into CAB Shell MenuStrip</a>. </p>
<h5>Funciones de edici&#243;n</h5>
<p>Las opciones para edici&#243;n se deben tratar de una forma particular para cumplir los siguientes dos requerimientos: cada bot&#243;n (del MainToolbar) o &#237;tem del men&#250; (EditMenu) debe ser habilitado o deshabilitado seg&#250;n se pueda o no realizar la operaci&#243;n (ej. Paste s&#243;lo cuando hay algo en el clipboard), y cada funci&#243;n debe poder ser implementada por varios m&#243;dulos (ej. el m&#243;dulo Document para la edici&#243;n del texto y el m&#243;dulo Proyecto para la edici&#243;n de los archivos y carpetas). Esto se puede resolver empleando comandos para cada funci&#243;n de edici&#243;n asociados a los &#237;tems y que estos comandos invoquen un evento individual para cada uno, de esta manera los m&#243;dulos subscriben a los eventos y son responsables de ejecutar la operaci&#243;n de edici&#243;n siempre que el usuario haya puesto el foco sobre la vista del m&#243;dulo en cuesti&#243;n. Los m&#243;dulos tambi&#233;n son responsables de actualizar el estado de activaci&#243;n de cada comando cada vez que alguna vista recibe el enfoque. </p>
<p>Los eventos a los que deben suscribirse los m&#243;dulos que necesitan realizar operaciones de edici&#243;n son los siguientes: EditCopy, EditCut, EditPaste, EditSelectAll, EditDelete, EditUndo, EditRedo, ShowFind, ShowReplace, ShowGoTo. Los comandos, que deben ser utilizados s&#243;lo para la activaci&#243;n de los items, tienen el mismo nombre (las constantes, el valor no es el mismo).</p>
<h5>Servicios de infraestructura</h5>
<p>Por ahora tengo pensados 2 servicios de infraestructura, el primero, &#8220;<strong>ExtensionService</strong>&#8220;, tiene funciones para facilitar la extensi&#243;n de los men&#250; y las barras de herramienta. El otro, &#8220;<strong>LoggingService</strong>&#8220;, permite mostrar al usuario informaci&#243;n de la ejecuci&#243;n de las operaciones, este servicio publica un evento al que deber&#225; suscribirse el m&#243;dulo que se encargue de mostrar resultados. </p>
<p>En los siguientes posts seguir&#233; con el desarrollo de los m&#243;dulos que compondr&#225;n la aplicaci&#243;n.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jcisneros/2008/02/28/desarrollando-ajgenesisstudio-03/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
