<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>THE .NET WAY</title>
	<atom:link href="http://www.thedotnetway.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedotnetway.net</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 14:05:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Extension Methods en MongoMapper.NET</title>
		<link>http://www.thedotnetway.net/2012/02/02/extension-methods-en-mongomapper-net/</link>
		<comments>http://www.thedotnetway.net/2012/02/02/extension-methods-en-mongomapper-net/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 19:07:13 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MongoMapper]]></category>
		<category><![CDATA[NOSQL]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=700</guid>
		<description><![CDATA[He subido una versión a master con el tema de los extension methods terminado. Un código que era: Country c = new Country &#123;Code =&#34;US&#34;, Name = &#34;Estados Unidos&#34;&#125;; c.Save&#60;Country&#62;&#40;&#41;; &#160; Country c2 = Country.FindByKey&#60;Country&#62;&#40;&#34;US&#34;&#41;; &#160; List&#60;Countries&#62; = Country.FindAsList&#60;Country&#62;&#40;&#34;Code&#34;, &#34;US&#34;&#41;; Se puede escribir: Country c = new Country &#123;Code =&#34;US&#34;, Name = &#34;Estados Unidos&#34;&#125;; c.Save&#40;&#41;;<a class="rmore" href="http://www.thedotnetway.net/2012/02/02/extension-methods-en-mongomapper-net/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>He subido una versión a master con el tema de los extension methods terminado.</p>
<p>Un código que era:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Country c <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Country <span style="color: #008000;">&#123;</span>Code <span style="color: #008000;">=</span><span style="color: #666666;">&quot;US&quot;</span>, Name <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Estados Unidos&quot;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
c<span style="color: #008000;">.</span><span style="color: #0000FF;">Save</span><span style="color: #008000;">&lt;</span>Country<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
Country c2 <span style="color: #008000;">=</span> Country<span style="color: #008000;">.</span><span style="color: #0000FF;">FindByKey</span><span style="color: #008000;">&lt;</span>Country<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;US&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
List<span style="color: #008000;">&lt;</span>Countries<span style="color: #008000;">&gt;</span> <span style="color: #008000;">=</span> Country<span style="color: #008000;">.</span><span style="color: #0000FF;">FindAsList</span><span style="color: #008000;">&lt;</span>Country<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Code&quot;</span>, <span style="color: #666666;">&quot;US&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Se puede escribir:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Country c <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Country <span style="color: #008000;">&#123;</span>Code <span style="color: #008000;">=</span><span style="color: #666666;">&quot;US&quot;</span>, Name <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Estados Unidos&quot;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
c<span style="color: #008000;">.</span><span style="color: #0000FF;">Save</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
Country c2 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Country<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
c<span style="color: #008000;">.</span><span style="color: #0000FF;">FillByKey</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;US&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
List<span style="color: #008000;">&lt;</span>Countries<span style="color: #008000;">&gt;</span> Countries <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>Countries<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
Countries<span style="color: #008000;">.</span><span style="color: #0000FF;">MongoFind</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Code&quot;</span>, <span style="color: #666666;">&quot;US&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p><a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/ExtensionTest.cs" target="_blank">Puedes ver ejemplos aquí.</a></p>
<p>La lista de extension methods es:</p>
<p>Para clases que heredan de MongoMapper:</p>
<ul>
<li>Save</li>
<li>Delete</li>
<li>FindByKey</li>
<li>FindByMongoId</li>
</ul>
<p>Para listas de objetos que hereden de MongoMapper:</p>
<ul>
<li>MongoFind</li>
</ul>
<p><center><br />
<strong><a href="https://github.com/emiliotorrens/MongoMapper.NET"><span style="font-size: small;">https://github.com/emiliotorrens/MongoMapper.NET</span></a></strong></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2012/02/02/extension-methods-en-mongomapper-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instala la ultima versión de MonoDevelop en Ubuntu</title>
		<link>http://www.thedotnetway.net/2012/01/23/instala-la-ultima-version-de-monodevelop-en-ubuntu/</link>
		<comments>http://www.thedotnetway.net/2012/01/23/instala-la-ultima-version-de-monodevelop-en-ubuntu/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 09:32:36 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[MonoDevelop]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=697</guid>
		<description><![CDATA[nbsp; Por alguna razón no esta disponible en el &#8220;Centro de Software de Ubuntu&#8221; la ultima versión de MonoDevelop, pero eso no quiere decir que no podamos instalarla, podemos bajarnos el código de github compilarlo e instalar la ultima versión en nuestro Ubuntu. Lo primero que necesitamos es el git instalado en el Ubuntu, abrimos<a class="rmore" href="http://www.thedotnetway.net/2012/01/23/instala-la-ultima-version-de-monodevelop-en-ubuntu/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>nbsp;</p>
<p>Por alguna razón no esta disponible en el &#8220;Centro de Software de Ubuntu&#8221; la ultima versión de <a href="http://monodevelop.com/" target="_blank">MonoDevelop</a>, pero eso no quiere decir que no podamos instalarla, podemos bajarnos el código de <a href="https://github.com/" target="_blank">github</a> compilarlo e instalar la ultima versión en nuestro Ubuntu.</p>
<p>Lo primero que necesitamos es el git instalado en el Ubuntu, abrimos un terminal y:<br />
<span style="color: #008000;">&gt; sudo apt-get install git-core</span><br />
<span style="color: #008000;"> &gt; sudo apt-get install git-doc</span></p>
<p>Después creas una carpeta nueva, te posicionas en ella y descargas la ultima versión del código desde github con:<br />
<span style="color: #008000;">&gt; git clone https://github.com/mono/monodevelop.git</span></p>
<p>Ahora ya tenemos el código, antes de seguir hay que ver si tenemos instalado todo lo necesario.</p>
<p>El autoconf y automake:<br />
<span style="color: #008000;">&gt; sudo apt-get install autoconf</span><br />
<span style="color: #008000;"> &gt; sudo apt-get install automake</span></p>
<p>El mono:<br />
<span style="color: #008000;">&gt; sudo apt-get install mono-complete</span><br />
<span style="color: #008000;"> &gt; sudo apt-get install mono-gmcs</span><br />
<span style="color: #008000;"> &gt; sudo apt-get install mono-adddins-utils</span></p>
<p>Los mono-addins necesarios:<br />
<span style="color: #008000;">&gt; sudo apt-get install libmono-addins-cil-dev</span><br />
<span style="color: #008000;"> &gt; sudo apt-get install libmono-addins-gui-cil-dev</span></p>
<p>librerias de gtc y gnome:<br />
<span style="color: #008000;">&gt; sudo apt-get install gtk-sharp2</span><br />
<span style="color: #008000;"> &gt; sudo apt-get install gnome-sharp2</span></p>
<p>Y esta,que reconozco no se para que es, pero hace falta:<br />
<span style="color: #008000;">&gt; sudo apt-get install intltool</span></p>
<p>Con todas las dependencias instaladas te metes en el directorio donde hemos descargado el código y:<br />
<span style="color: #008000;">&gt;./configure</span></p>
<p>Cuando termine<br />
<span style="color: #008000;">&gt;make</span></p>
<p>y cuanto termine<br />
<span style="color: #008000;">&gt;sudo make install</span></p>
<p>y listo ya tienes la ultima versión de MonoDevelop Instalada</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2012/01/23/instala-la-ultima-version-de-monodevelop-en-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>primer Vistazo al framework cakephp</title>
		<link>http://www.thedotnetway.net/2012/01/12/primer-vistazo-al-framework-cakephp/</link>
		<comments>http://www.thedotnetway.net/2012/01/12/primer-vistazo-al-framework-cakephp/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 19:08:02 +0000</pubDate>
		<dc:creator>Mario Andujar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=680</guid>
		<description><![CDATA[En este post os voy a hablar de este framework php llamado CakePHP. Es un framework de desarrollo rápido en PHP. Sigue una estructura de archivos MVC y ORM. Este framework intenta ayudar al desarrollador a escribir menos líneas código. Yo por mi experiencia os puede decir que lo logra y su uso es muy<a class="rmore" href="http://www.thedotnetway.net/2012/01/12/primer-vistazo-al-framework-cakephp/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thedotnetway.net/wp-content/uploads/2012/01/cakephp21024768.jpg"><img style="display: inline; margin-left: 0px; margin-right: 10px; border-width: 0px;" title="cakephp2-1024-768" src="http://www.thedotnetway.net/wp-content/uploads/2012/01/cakephp21024768_thumb.jpg" alt="cakephp2-1024-768" width="244" height="184" align="left" border="0" /></a></p>
<p>En este post os voy a hablar de este framework php llamado CakePHP. Es un framework de desarrollo rápido en PHP. Sigue una estructura de archivos MVC y ORM. Este framework intenta ayudar al desarrollador a escribir menos líneas código. Yo por mi experiencia os puede decir que lo logra y su uso es muy sencillo.</p>
<p>En la actualidad, están por la versión 1.3.14 estable.</p>
<p>A continuación os pondré una lista de sus características.</p>
<ul>
<li>Arquitectura Modelo, Vista, Controlador</li>
<li>Aplicación Scaffolding</li>
<li>Código generado vía Bake</li>
<li>Helpers para HTML, Forms, Paginación, Ajax, Javascript, XML, RSS y mas</li>
<li>Lista de control de acceso y autentificación</li>
<li>Sencillo pero amplio validador del modelo de datos</li>
<li>Router para la asignación de URL’s y extensiones handling</li>
<li>Seguridad, Sesión  y componentes RequestHandler</li>
<li>Clases para trabajar con Archivos, Carpetas, Arrays y mas</li>
<li>etc</li>
</ul>
<p>Una vez descargado el framework observamos 3 carpetas principales:</p>
<ul>
<li><strong>app</strong>: Es donde se ubicaran los ficheros de tu aplicación.</li>
<li><strong>cake</strong></li>
<li><strong>vendors</strong>: Aquí es donde meteremos todas las librerías de terceros.</li>
</ul>
<p>Dentro de la carpeta App encontraremos la siguiente estructura:</p>
<ul>
<li><strong>config</strong>: Aquí se ubican los pocos archivos de configuración de bases datos, arranque, archivos de configuración del núcleo, etc.</li>
<li><strong>controllers</strong>: Se ubican todos los controladores de tu aplicación.</li>
<li><strong>locale</strong>: Almacena los archivos de recursos de localización (idioma)</li>
<li><strong>models</strong>: Contiene los modelos de tu aplicación.</li>
<li><strong>plugins</strong>: Contiene los paquetes de plugins.</li>
<li><strong>tmp</strong>: Aquí se guarda información temporal.</li>
<li><strong>vendors</strong>: Aquí se guardan librerías o clases de terceros.</li>
<li><strong>views</strong>: Se ubica los archivos de visualización aquí.</li>
<li><strong>webroot</strong>: Esta carpeta es la raíz del sitio. Dentro se ubican css, imagenes y JavaScript.</li>
</ul>
<p>Bueno hasta aquí he hecho una pequeña introducción. Mas adelante pondré unos ejemplos y algunos consejos.</p>
<p>Saludos <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2012/01/12/primer-vistazo-al-framework-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changelog de MongoMapper.NET</title>
		<link>http://www.thedotnetway.net/2012/01/05/changelog-de-mongomapper-net-2-2/</link>
		<comments>http://www.thedotnetway.net/2012/01/05/changelog-de-mongomapper-net-2-2/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 20:09:29 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Microsoft.NET]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MongoMapper]]></category>
		<category><![CDATA[NOSQL]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=643</guid>
		<description><![CDATA[Acabo de subir una nueva versión del MongoMapper para .NET, no lleva muchos cambios pero los que lleva son interesantes. Ahora hay disponibles “Extension Methods” en las las listas de Objetos y en los Objetos que heredan de MongoMapper y se pueden cargar los objetos tipo MyClass.FindByKey(…) o MyClassList.MongoFind(…). He hecho algunas pruebas viendo lo<a class="rmore" href="http://www.thedotnetway.net/2012/01/05/changelog-de-mongomapper-net-2-2/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thedotnetway.net/wp-content/uploads/2012/01/mongodb.jpg"><img style="background-image: none; margin: 0px 6px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; padding-top: 0px; border-width: 0px;" title="mongodb" src="http://www.thedotnetway.net/wp-content/uploads/2012/01/mongodb_thumb.jpg" alt="mongodb" width="162" height="108" align="left" border="0" /></a>Acabo de subir una nueva versión del MongoMapper para .NET, no lleva muchos cambios pero los que lleva son interesantes.</p>
<p>Ahora hay disponibles<em> </em><a href="http://en.wikipedia.org/wiki/Extension_method"><em>“Extension Methods”</em></a> en las las listas de Objetos y en los Objetos que heredan de MongoMapper y se pueden cargar los objetos tipo <em>MyClass.FindByKey(…)</em> o <em>MyClassList.MongoFind(…).</em></p>
<p>He hecho algunas pruebas viendo lo que tarda de una manera y la otra y no hay prácticamente diferencia, de todas formas eran pruebas preliminares.</p>
<p>El código queda algo mejor sin acceder a los métodos estáticos de la clase base:</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">List&lt;Country&gt; countries = <span style="color: #0000ff;">new</span> List&lt;Country&gt;();</pre>
<p>&nbsp;</p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">countries.MongoFind(Query.Or(MongoQuery.Eq((Country co) =&gt; co.Code, <span style="color: #006080;">"ES"</span>), MongoQuery.Eq((Country co) =&gt; co.Code, <span style="color: #006080;">"UK"</span>)));</pre>
<p>&nbsp;</p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">Country country = <span style="color: #0000ff;">new</span> Country();</pre>
<p>&nbsp;</p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">country.FindByKey(<span style="color: #006080;">"ES"</span>);</pre>
<p>&nbsp;</p>
</div>
</div>
<p>Puedes ver <a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test/ExtensionTest.cs">algunos ejemplos y las pruebas aquí</a>, cualquier bug o mejora que se te ocurra, fork o mail me <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://www.thedotnetway.net/wp-content/uploads/2012/01/wlEmoticon-smile.png" alt="Sonrisa" /></p>
<p align="center"><a href="https://github.com/emiliotorrens/MongoMapper.NET"><strong><span style="font-size: small;">https://github.com/emiliotorrens/MongoMapper.NET</span></strong></a></p>
<p align="center">.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2012/01/05/changelog-de-mongomapper-net-2-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tiempos de proceso en .NET</title>
		<link>http://www.thedotnetway.net/2012/01/05/tiempos-de-proceso-en-net/</link>
		<comments>http://www.thedotnetway.net/2012/01/05/tiempos-de-proceso-en-net/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 19:18:25 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft.NET]]></category>
		<category><![CDATA[StopWatch]]></category>
		<category><![CDATA[System.Diagnostics]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=634</guid>
		<description><![CDATA[La mejor forma de medir tiempo de proceso en nuestro código es usando StopWatch. Esta clase es la que nos dará toda la información que necesitamos, la encontraremos en el espacio de nombres System.Diagnostics. Aquí dejo un ejemplo de uso: var timer = System.Diagnostics.Stopwatch.StartNew(); for (int i = 0; i &#60; 1000000; i++) { //...<a class="rmore" href="http://www.thedotnetway.net/2012/01/05/tiempos-de-proceso-en-net/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>La mejor forma de medir tiempo de proceso en nuestro código es usando StopWatch. </p>
<p>Esta clase es la que nos dará toda la información que necesitamos, la encontraremos en el espacio de nombres System.Diagnostics. </p>
<p>Aquí dejo un ejemplo de uso: </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">var timer = System.Diagnostics.Stopwatch.StartNew();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 1000000; i++)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">//...</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">timer.Stop();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Console.WriteLine(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;Elapsed: {0}&quot;</span>, timer.Elapsed));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Console.WriteLine(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;MS: {0}&quot;</span>, timer.ElapsedMilliseconds));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Console.WriteLine(<span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;Ticks: {0}&quot;</span>, timer.ElapsedTicks));</pre>
<p><!--CRLF--></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2012/01/05/tiempos-de-proceso-en-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changelog de MongoMapper.NET</title>
		<link>http://www.thedotnetway.net/2011/12/30/changelog-de-mongomapper-net-2/</link>
		<comments>http://www.thedotnetway.net/2011/12/30/changelog-de-mongomapper-net-2/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 10:14:48 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Microsoft.NET]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MongoMapper]]></category>
		<category><![CDATA[NOSQL]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=629</guid>
		<description><![CDATA[Creo que la versión ya esta mas o menos para probar así que toca escribir el changelog de las ultimas modificaciones, las hechas desde que lo movimos de codeplex a github. Casi todas las modificaciones vienen de refactoring o de necesidades que me he ido encontrando al hacer pruebas con una CRS cambiando el SQL<a class="rmore" href="http://www.thedotnetway.net/2011/12/30/changelog-de-mongomapper-net-2/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.emiliotorrens.com/wp-content/uploads/2011/11/mongodb-e1262178479348.png"><img style="margin: 0px 5px 0px 0px;" title="mongodb-e1262178479348" src="http://www.emiliotorrens.com/wp-content/uploads/2011/11/mongodb-e1262178479348_thumb.png" alt="mongodb-e1262178479348" width="150" height="64" align="left" border="0" /></a></p>
<p>Creo que la versión ya esta mas o menos para probar así que toca escribir el changelog de las ultimas modificaciones, las hechas desde que lo movimos de codeplex a github.</p>
<p>Casi todas las modificaciones vienen de refactoring o de necesidades que me he ido encontrando al hacer pruebas con una CRS cambiando el SQL por <a href="http://en.wikipedia.org/wiki/MongoDB" target="_blank">MongoDB</a>, pero cualquier sugerencia es bienvenida.</p>
<p>Los cambios:</p>
<ul>
<li>El id pasa a ser Long, era necesario para poderlo definir como autoincremental, además es mas legible.</li>
<li>Añadidos <em>extension methods</em> de búsqueda (MongoFind) para las Listas de objetos (que hereden de MongoMapper), puedes ver el <a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper/Core/ExtensionMethods.cs" target="_blank">código aquí</a> y <a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test/ExtensionTest.cs" target="_blank">ejemplos aquí</a></li>
<li>Posibilidad de guardar en un campo de la clase base el Documento Original en el momento de Deserializar, de esta manera podemos <a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test/OriginalObjectTest.cs" target="_blank">comprobar cambios</a>y, en un futuro, hacer rollback.</li>
<li>Al intentar insertar un documento que ya existe posibilidad de lanzar excepción o de modificar el existente.</li>
<li>Si no se define MongoKey o se le define vacío usa por defecto el id como PK.</li>
<li>Parada la opción de pasar expresiones para los filtros, vi que la gente del Driver estaba trabajando en algo igual, así que esperare que lo terminen <img src='http://www.thedotnetway.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>Intento tipar un poco los Querys, puedes crear un Query pasándole el campo en una expresión, tipo:<em> MongoQuery.Eq((Country c) =&gt; c.Code, &#8220;ES&#8221;)</em>, <a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test/FindTest.cs" target="_blank">puedes ver ejemplos aquí</a>.</li>
<li>Añadidos metodos de búsqueda que devuelven un cursor, ahora existen los FindAsList y los FindAsCursor, así se pueden usar los SetFields, SetLimit, SetSkip etc ..</li>
<li>Sección de configuración propia en el config de la aplicación, puedes ver este <a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test/App.config" target="_blank">ejemplo</a>.</li>
<li>Añadidas mas opciones de configuración:
<ul>
<li>MaxDocumentSize</li>
<li>SafeMode</li>
<li>FSync</li>
<li>ExceptionOnDuplicateKey</li>
<li>EnableOriginalObject</li>
<li>UseIncrementalId</li>
<li>PoolSize</li>
<li>WaitQueueTimeout</li>
</ul>
</li>
</ul>
<p>El tema de usar un id Incremental afecta al rendimiento a la hora de insertar documentos ya que lo que hace es crear una colección donde guarda el ultimo id usado para cada colección y tiene que incrementar en cada insert, puedes ver el <a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper/Core/MongoMapperIdGenerator.cs" target="_blank">código aquí</a>, es configurable el usarlo o no.</p>
<p>Otro tema que afecta al rendimiento es el de guardar el Objeto original, por eso lo puse configurable también, afecta al rendimiento de lectura ya que hace una Serializacion al Deserializar cada documento para guardar una copia en formato JSV, aunque esto no se nota mucho, para Serilizar/Deserializar en el tema del Documento Original utilizo <a href="https://github.com/ServiceStack/ServiceStack.Text" target="_blank">ServiceStack.Text</a>, es lo mas rápido que he encontrado, así que ahora tiene esa dependencia.</p>
<p>En el <a href="https://github.com/emiliotorrens/MongoMapper.NET/tree/master/EtoolTech.MongoDB.Mapper.Test" target="_blank">proyecto de Test</a> puedes ver algunos ejemplos de como usar MongoMapper, agradezco cualquier idea/comentario</p>
<p align="center"><a href="https://github.com/emiliotorrens/MongoMapper.NET"><strong><span style="font-size: medium;">https://github.com/emiliotorrens/MongoMapper.NET</span></strong></a></p>
<p align="center">.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2011/12/30/changelog-de-mongomapper-net-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extension Methods en .NET</title>
		<link>http://www.thedotnetway.net/2011/12/23/extensionmethods/</link>
		<comments>http://www.thedotnetway.net/2011/12/23/extensionmethods/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 10:43:49 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Trucos]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=621</guid>
		<description><![CDATA[Los ExtensionMethods nos permiten crear metodos que estén disponibles en todos los tipos de objetos que les definamos. Por ejemplo podemos definir que todas nuestras clases tipo A tengan un método ToJson que devuelva una String con el Json creando el siguiente método: public static string ToJson(this A o) {return JsonConvert.SerializeObject(o);} Lo único que hay<a class="rmore" href="http://www.thedotnetway.net/2011/12/23/extensionmethods/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>Los ExtensionMethods nos permiten crear metodos que estén disponibles en todos los tipos de objetos que les definamos.</p>
<p>Por ejemplo podemos definir que todas nuestras clases tipo A tengan un método ToJson que devuelva una String con el Json creando el siguiente método:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> ToJson(<span style="color: #0000ff">this</span> A o) {<span style="color: #0000ff">return</span> JsonConvert.SerializeObject(o);}</pre>
<p><!--CRLF--></div>
</div>
<p>Lo único que hay que hacer es using del namespace donde estén definidos los metodos.</p>
<p>En este ejemplo creamos un ExtensionMethod para que todos los objetos tengan el método ToJson, eso lo hacemos creando el método con Object, y después le añadimos un método al object String para que lo transforme en un Objeto Tipado</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> ToJson(<span style="color: #0000ff">this</span> Object o) {<span style="color: #0000ff">return</span> JsonConvert.SerializeObject(o);}</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> T FromJson&lt;T&gt;(<span style="color: #0000ff">this</span> String str) {<span style="color: #0000ff">return</span> JsonConvert.DeserializeObject&lt;T&gt;(str);}</pre>
<p><!--CRLF--></div>
</div>
<p>Aquí el Test:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyClass</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> <span style="color: #0000ff">value</span> { get; set; }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> value2 { get; set; }        </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&nbsp;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">[TestClass]</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ExtensionMethodsTest</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [TestMethod]</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Test()</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        MyClass c = <span style="color: #0000ff">new</span> MyClass {<span style="color: #0000ff">value</span> = <span style="color: #006080">"hola"</span>,value2 = 50};</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">string</span> jsong = c.ToJson();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&nbsp;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        MyClass c2 = jsong.FromJson&lt;MyClass&gt;();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2011/12/23/extensionmethods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Personalizando los &#8220;cast&#8221; en .NET</title>
		<link>http://www.thedotnetway.net/2011/12/20/personalizando-los-casting-en-net-2/</link>
		<comments>http://www.thedotnetway.net/2011/12/20/personalizando-los-casting-en-net-2/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 14:42:12 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Trucos]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=608</guid>
		<description><![CDATA[Aquí dejo un ejemplo de como personalizar el cast de nuestras clases a otras con implicit/explicit operator, por si nos interesa controlar la conversión. Las clases: public class ClassString { public string value1 { get; set; } public string value2 { get; set; } &#160; public static implicit operator ClassInt(ClassString c2) { ClassInt c =<a class="rmore" href="http://www.thedotnetway.net/2011/12/20/personalizando-los-casting-en-net-2/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>Aquí dejo un ejemplo de como personalizar el cast de nuestras clases a otras con implicit/explicit operator, por si nos interesa controlar la conversión.</p>
<p>Las clases:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ClassString</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> value1 { get; set; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> value2 { get; set; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">implicit</span> <span style="color: #0000ff">operator</span> ClassInt(ClassString c2)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        ClassInt c = <span style="color: #0000ff">new</span> ClassInt</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            value1 = <span style="color: #0000ff">int</span>.Parse(c2.value1),</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            value2 = <span style="color: #0000ff">int</span>.Parse(c2.value2)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        };</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> c;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ClassInt</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> value1 { get; set; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> value2 { get; set; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">explicit</span> <span style="color: #0000ff">operator</span> ClassString(ClassInt c2)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        ClassString c = <span style="color: #0000ff">new</span> ClassString</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            value1 = c2.value1.ToString(), </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            value2 = c2.value2.ToString()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        };</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> c;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }                   </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
<p>El test:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">[TestMethod]</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> TestMethod1()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    ClassInt c1 = <span style="color: #0000ff">new</span> ClassInt {value1 = 100,value2 = 200};</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    ClassString c2 = (ClassString) c1;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Assert.AreEqual(c2.value1, <span style="color: #006080">&quot;100&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Assert.AreEqual(c2.value2, <span style="color: #006080">&quot;200&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    ClassInt c3 = c2;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Assert.AreEqual(c3.value1, 100);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Assert.AreEqual(c3.value2, 200);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2011/12/20/personalizando-los-casting-en-net-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AOP y PostSharp</title>
		<link>http://www.thedotnetway.net/2011/12/19/aop-y-postsharp/</link>
		<comments>http://www.thedotnetway.net/2011/12/19/aop-y-postsharp/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 12:38:20 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AOP]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[POA]]></category>
		<category><![CDATA[PostSharp]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/?p=600</guid>
		<description><![CDATA[AOP o POA en Español quiere decir Programación Orientada a Aspectos, este paradigma, que es relativamente moderno, no substituye a OOP en realidad la que hace es extenderlo. Esta es la definición “formal” de AOP: “El principal objetivo de la POA es la separación de las funcionalidades dentro del sistema: Por un lado funcionalidades comunes<a class="rmore" href="http://www.thedotnetway.net/2011/12/19/aop-y-postsharp/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p>AOP o POA en Español quiere decir Programación Orientada a Aspectos, este paradigma, que es relativamente moderno, no substituye a OOP en realidad la que hace es extenderlo.</p>
<p>Esta es la definición “formal” de AOP:</p>
<p><em>“El principal objetivo de la POA es la separación de las funcionalidades dentro del sistema:</em></p>
<p><em>Por un lado funcionalidades comunes utilizadas a lo largo de la aplicación. <br />Por otro lado, las funcionalidades propias de cada módulo.</em></p>
<p><em>Cada funcionalidad común se encapsulará en una entidad.”</em></p>
<p>Hay varios frameworks que nos ayudan a programar AOP, yo el que estoy usando es “<a href="http://www.sharpcrafters.com/" target="_blank">PostSharp</a>” que es para .net, y con este voy a poner un ejemplo en el que logueamos el usuario y la fecha de modificación en todos nuestros objetos implementando un interface y añadiendo un atributo al método Save.</p>
<p>Creamos el <strong>interface</strong>:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">interface</span> ILogeable</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     <span style="color: #0000ff">string</span> LastModificationUser { get; set; }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     DateTime LastModificationDateTime { get; set; }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> }</pre>
<p><!--CRLF--></div>
</div>
<p>Luego creamos el <strong>atributo</strong>, aquí es donde esta el tema, el atributo lo creamos heredando una clase de OnMethodBoundaryAspect, que es una clase de PostSharp, de esa clase luego sobre escribimos los metodos que nos interese, estos metodos son los que se llamaran desde el método de nuestras clases que tengan este atributo, hay 4 metodos a sobre escribir: OnEntry, OnExit, OnSuccess y OnException como parámetro recibimos unos MethodExecutionArgs en los que encontraremos toda la información necesaria.</p>
<p>En este caso solo utilizo el OnEntry</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">[Serializable()]</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> LogAttribute : OnMethodBoundaryAspect</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">void</span> OnEntry(MethodExecutionArgs args)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (<span style="color: #0000ff">typeof</span>(ILogeable).IsAssignableFrom(args.Instance.GetType()))</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            ((ILogeable) args.Instance).LastModificationUser = Thread.CurrentPrincipal.Identity.Name;               </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            ((ILogeable) args.Instance).LastModificationDateTime = DateTime.Now;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }        </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
<p>Cualquier <strong>clase</strong> que implemente el interfaz y le pongamos el atributo en el método que queramos ejecutara este código, por ejemplo:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MyClass: ILogeable</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> LastModificationUser { get; set; }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> DateTime LastModificationDateTime { get; set; }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&nbsp;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [Log]</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Save() {}</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
<p>Una de las cosas que me gusta de PostSharp es que no ejecuta por reflection en tiempo de ejecución si no que inyecta código en tus metodos en tiempo de compilación, así que no afecta de manera negativa al performance de la aplicación.</p>
<p>No dejéis de revisar el método “CompileTimeInitialize”, en el podemos usar reflection tranquilamente, ya que se ejecuta en tiempo de compilación, para guardar valores en variables y usarlas luego en tiempo de ejecución, por ejemplo:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&nbsp;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">void</span> CompileTimeInitialize(System.Reflection.MethodBase method, AspectInfo aspectInfo)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">string</span> objName = method.DeclaringType.Name;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">string</span> methodName = method.Name;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
<p>Este es un ejemplo sencillo, las posibilidades son muchísimas, podéis ver muchos ejemplos en la pagina del PostSharp.</p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2011/12/19/aop-y-postsharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoMapper.NET esta ahora en GitHub</title>
		<link>http://www.thedotnetway.net/2011/11/22/mongomapper-net-esta-ahora-en-github/</link>
		<comments>http://www.thedotnetway.net/2011/11/22/mongomapper-net-esta-ahora-en-github/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 09:37:49 +0000</pubDate>
		<dc:creator>Emilio Torrens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MongoMapper]]></category>
		<category><![CDATA[NOSQL]]></category>

		<guid isPermaLink="false">http://www.thedotnetway.net/2011/11/22/mongomapper-net-esta-ahora-en-github/</guid>
		<description><![CDATA[Hemos estado un tiempo con el proyecto parado, no le hemos podido dedicar horas por falta de tiempo libre en casa y porque no nos quedaban muchas horas libres para “inventar” en el trabajo, pero eso ya paso, así que retomamos el tema. Hemos movido el proyecto desde codeplex a github, así no es necesario<a class="rmore" href="http://www.thedotnetway.net/2011/11/22/mongomapper-net-esta-ahora-en-github/">&#160;&#160; Read More ...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thedotnetway.net/wp-content/uploads/2011/11/mongodb-e1262178479348.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="mongodb-e1262178479348" border="0" alt="mongodb-e1262178479348" align="left" src="http://www.thedotnetway.net/wp-content/uploads/2011/11/mongodb-e1262178479348_thumb.png" width="215" height="92" /></a>Hemos estado un tiempo con el proyecto parado, no le hemos podido dedicar horas por falta de tiempo libre en casa y porque no nos quedaban muchas horas libres para “inventar” en el trabajo, pero eso ya paso, así que retomamos el tema.</p>
<p>Hemos movido el proyecto desde codeplex a <a href="https://github.com/emiliotorrens/MongoMapper.NET" target="_blank">github</a>, así no es necesario tener una licencia de Team Explorer ni el Visual Studio para contribuir.</p>
<p><a href="https://github.com/emiliotorrens/MongoMapper.NET"><strong><font size="4">https://github.com/emiliotorrens/MongoMapper.NET</font></strong></a></p>
<p>Ahora nos vamos a centrar en el rendimiento y en ver como implementar algún sistema de transacciones, el tema de parseo de expresiones para filtrar de momento queda parado ya que he visto que la gente del Driver esta desarrollando el tema de LINQ, así que esperamos a ver que pasa.</p>
<p>La versión subida es prácticamente la misma que la ultima de codeplex con estas modificaciones:</p>
<p>- Actualizadas las dependencias a la ultima versión del Driver de Mongo    <br />- Re-escrito tema de busquedas, eliminadas algunas opciones inútiles, posibilidad de devolver List o MongoCursor, utiliza QueryComplete como parámetro en vez de clases propias y algunas cosas mas &#8230;     <br />- Añadido ITransaction para desarrollar el tema de transacciones     <br />- La búsqueda por expresiones devuelve siempre un NotImplementedException ahora, esta pendiente revisar todo el código</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedotnetway.net/2011/11/22/mongomapper-net-esta-ahora-en-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

