<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-27752126</id><updated>2009-11-24T23:39:00.282+01:00</updated><title type='text'>Variable not found</title><subtitle type='html'>Artículos, noticias, curiosidades, reflexiones... sobre el mundo del desarrollo de software, internet, u otros temas relacionados con la tecnología.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default?start-index=26&amp;max-results=25'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>277</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-27752126.post-5009089461667406729</id><published>2009-11-24T23:39:00.000+01:00</published><updated>2009-11-24T23:39:00.336+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jqGrid'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><title type='text'>Borrado de registros con jqGrid y ASP.NET MVC</title><content type='html'>&lt;p&gt;En un post anterior dedicado a &lt;a title="jqGrid: Grids espectaculares para ASP.NET MVC, paso a paso" href="http://www.variablenotfound.com/2009/10/jqgrid-grids-espectaculares-para-aspnet.html" target="_blank"&gt;jqGrid y ASP.NET MVC&lt;/a&gt; vimos lo sencillo que resultaba implementar un potente grid para mostrar datos tabulares, permitiendo paginación, ordenación y redimensionado de columnas.&lt;/p&gt;  &lt;p&gt;Pero, como ya comenté entonces, &lt;a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:features" hreflang="en"&gt;jqGrid es mucho más que eso&lt;/a&gt;. En este artículo estudiaremos la implementación de la funcionalidad de borrado de filas integrada en el propio componente, utilizando intercambio de datos Ajax con el lado servidor para actualizar el modelo.&lt;/p&gt;  &lt;p&gt;Partiremos del ejemplo que desarrollamos anteriormente, y nos centraremos únicamente en introducir los cambios necesarios para introducir esta nueva capacidad. También, como en el caso anterior, encontraréis al final un enlace al proyecto de demostración, para Visual Web Developer Express 2008 SP1 y ASP.NET MVC 1.0.&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;1. Preparamos la infraestructura&lt;/h4&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Selección de módulos en jqGrid" border="0" alt="Selección de módulos en jqGrid" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SvcaWDEGFXI/AAAAAAAABJ0/5JT_kgPTTeY/image%5B7%5D.png?imgmax=800" width="284" height="296" /&gt;Antes de nada, y es algo que es importante recordar cuando trabajemos con jqGrid, debemos pensar qué módulos de este componente necesitamos en nuestro proyecto. &lt;/p&gt;  &lt;p&gt;En el &lt;a title="jqGrid: Grids espectaculares para ASP.NET MVC" href="http://www.variablenotfound.com/2009/10/jqgrid-grids-espectaculares-para-aspnet.html"&gt;post anterior&lt;/a&gt; descargamos exclusivamente los necesarios para implementar la visualización del grid; ahora, dado que vamos a utilizar más funcionalidades del componente, debemos seleccionar en la &lt;a title="jqGrid download" href="http://www.trirand.com/blog/?page_id=6"&gt;herramienta de descarga&lt;/a&gt; aquellos que nos harán falta, el base y los relativos a la edición de datos.&lt;/p&gt;  &lt;p&gt;En teoría deberíamos seleccionar los módulos estrictamente necesarios para nuestros fines, pero en la práctica no es fácil adivinar cuál de ellos implementa justamente lo que estamos buscando. De hecho, es bastante frecuente encontrarse con errores de script cuando no acertamos con el módulo exacto, al que siguen bastantes iteraciones prueba-error hasta que conseguimos averiguar cuál debemos indicar en la descarga.&lt;/p&gt;  &lt;p&gt;Por eso en este caso, seleccionaremos todos los módulos relativos a la edición; eso nos permitirá, además, seguir implementando funcionalidades como el alta o la modificación sin tener que volver a descargar componentes.&lt;/p&gt;  &lt;p&gt;Aparte de los módulos a incluir en la descarga, el resto de los pasos de preparación de la infraestructura son idénticos a los descritos en los &lt;a title="jqGrid: grids espectaculares para ASP.NET MVC" href="http://www.variablenotfound.com/2009/10/jqgrid-grids-espectaculares-para-aspnet.html"&gt;puntos 1 al 3 del post inicial&lt;/a&gt;:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Copiar los archivos de script (jqGrid y el archivo de localización) en el proyecto. &lt;/li&gt;    &lt;li&gt;Descargar el tema visual de jQuery UI y añadirlo al proyecto. &lt;/li&gt;    &lt;li&gt;referenciar las librerías de scripts y estilos en la master (o vistas donde vayamos a usarlo). &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;2. El modelo&lt;/h4&gt;  &lt;p&gt;Vamos a ampliar la clase &lt;code&gt;GestorDeAmigos&lt;/code&gt; anterior para que sea capaz de emular el almacenamiento en una base de datos, pero utilizando como soporte una colección en memoria que haremos persistir en una variable de aplicación. Además, aprovecharemos para añadirle un método &lt;code&gt;Delete()&lt;/code&gt; que nos permita eliminar del almacén la persona cuyo “Id” le pasemos como parámetro.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; Delete(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; id)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Amigo amigo = DatosAmigos.FirstOrDefault(a =&amp;gt; a.Id == id);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (amigo == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    DatosAmigos.Remove(amigo);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;div&gt;No profundizaré más en el modelo, pues el código es de lo más convencional. El que tenga curiosidad por ver cómo se implementa el almacén en una variable de aplicación, que acuda al fuente del proyecto de demostración.&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h4&gt;3. La vista&lt;/h4&gt;&lt;p&gt;En la vista debemos hacer muy pocos ajustes para permitir la eliminación de los datos. Básicamente, tendremos que habilitar un panel de botones en el grid, indicar que deseamos que aparezca el botón de eliminación, y configurar el comportamiento de éste, para lo cual invocaremos al método &lt;code&gt;navGrid()&lt;/code&gt; después de la llamada de inicialización del grid que ya vimos el otro día:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;script type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    jQuery(document).ready(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        jQuery(&lt;span style="color: #006080"&gt;&amp;quot;#list&amp;quot;&lt;/span&gt;).jqGrid({&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            [...] &lt;span style="color: #008000"&gt;// OMITIDO. Idéntico al del post anterior.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        });&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;#list&amp;quot;&lt;/span&gt;).navGrid(&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                { refresh: &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, add: &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;, edit: &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;, del: &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, search: &lt;span style="color: #0000ff"&gt;false&lt;/span&gt; },&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, &lt;span style="color: #008000"&gt;// parámetros para el alta&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, &lt;span style="color: #008000"&gt;// parámetros para la edición&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                {     &lt;span style="color: #008000"&gt;// parámetros para la eliminación&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    url: &lt;span style="color: #006080"&gt;'&amp;lt;%= Url.Action(&amp;quot;Eliminar&amp;quot;) %&amp;gt;'&lt;/span&gt;,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    width: 500,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    afterSubmit: &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;(r, d) {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; [r.responseText==&lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, r.responseText];&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        );&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;});&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Los parámetros que estamos pasando al método &lt;code&gt;navGrid()&lt;/code&gt; son los siguientes:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;el primer parámetro debería ser &lt;code&gt;jQuery('#pager')&lt;/code&gt;, que es la referencia hacia el control de paginación que estamos utilizando. En este caso es un nulo porque esta referencia se incluyó en la inicialización de jqGrid.&lt;br /&gt; &lt;/li&gt;  &lt;li&gt;A continuación, creamos un objeto anónimo en el que establecemos a &lt;code&gt;true&lt;/code&gt; las propiedades &lt;code&gt;del&lt;/code&gt; y &lt;code&gt;refresh&lt;/code&gt;, que indica que queremos mostrar los botones de eliminación y recarga de datos. El resto de propiedades predefinidas, &lt;code&gt;add&lt;/code&gt;, &lt;code&gt;edit&lt;/code&gt;, y &lt;code&gt;search&lt;/code&gt;, equivalentes a los botones de añadir, editar y buscar registros, respectivamente, las establecemos a &lt;code&gt;false&lt;/code&gt; con objeto de que no aparezcan botones para invocarlas; ya las activaremos en otros posts ;-)    &lt;br /&gt; &lt;/li&gt;  &lt;li&gt;el siguiente parámetro se trata de un objeto donde configuramos el comportamiento del botón de alta de registros. Dado que no vamos a implementarlo ahora, lo establecemos a nulo.    &lt;br /&gt; &lt;/li&gt;  &lt;li&gt;el cuarto parámetro es lo mismo que el anterior, pero para configurar la edición, por lo que también se encuentra establecido a &lt;code&gt;null&lt;/code&gt;.    &lt;br /&gt; &lt;/li&gt;  &lt;li&gt;a continuación, y por último, el objeto en cuyas propiedades definimos el comportamiento del botón de eliminación:    &lt;br /&gt;     &lt;br /&gt;    &lt;ul&gt;      &lt;li&gt;La URL a la acción que se invocará en servidor, que la obtenemos utilizando el &lt;a title="UrlHelper en MSDN" href="http://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.aspx"&gt;UrlHelper&lt;/a&gt; de MVC. En este caso, invocaremos a una acción llamada “Eliminar”, a la que el sistema enviará el Id del registro activo.         &lt;br /&gt;&lt;/li&gt;      &lt;li&gt;El ancho del cuadro de diálogo de confirmación.         &lt;br /&gt;&lt;/li&gt;      &lt;li&gt;En &lt;code&gt;afterSubmit&lt;/code&gt; implementamos una función callback que jqGrid llamará cuando haya recibido el resultado de la petición Ajax. El primer parámetro que nos envía es el objeto &lt;code&gt;XMLHttpRequest&lt;/code&gt; donde encontraremos la respuesta obtenida desde el servidor; el segundo parámetro contiene los datos que han sido enviados a la petición.         &lt;br /&gt;        &lt;br /&gt;El retorno de la función callback debe ser siempre un array con dos elementos. El primero es un booleano indicando si la eliminación ha tenido éxito, y el segundo es el mensaje de error, en caso de que se haya producido:&lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;          &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;            &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; [ exito , &lt;span style="color: #006080"&gt;&amp;quot;mensaje de error&amp;quot;&lt;/span&gt; ];&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;        &lt;/div&gt;        &lt;br /&gt;Es importante ahora resaltar una cosa: salvo los parámetros de entrada y el tipo de retorno descritos anteriormente, jqGrid no nos impone ninguna particularidad más respecto a cómo debemos implementar este método, el tipo de información que recibiremos desde el controlador o cómo la procesaremos al recibirla. Somos totalmente libres de elegir la forma en la que haremos las cosas.         &lt;br /&gt;        &lt;br /&gt;En nuestro caso, vamos a hacer una implementación muy simple en base a la siguiente convención: el controlador retornará un string con una descripción del error en caso de que se produzca algún problema borrando el registro, y retornará un nulo cuando todo vaya bien. Esto nos permite implementar el callback utilizando la siguiente expresión: &lt;/li&gt;    &lt;/ul&gt;  &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;  &lt;ul&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; [r.responseText==&lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, r.responseText];&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;/div&gt;    &lt;br /&gt;Si observáis, estamos llenando el array de retorno de tal forma que el primer parámetro será cierto si la respuesta obtenida está vacía (o sea, no hay error), y en el segundo parámetro introducimos la respuesta tal cual la hemos obtenido del servidor.     &lt;br /&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;h4&gt;4. El controlador&lt;/h4&gt;&lt;p&gt;Dado que la lógica la tenemos implementada en el modelo, y que la vista ya está preparada para ponerse en contacto con el controlador vía Ajax y para recibir el feedback sobre el éxito de la operación, sólo nos queda implementar muy rápidamente el método de acción:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Eliminar(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; id)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!gestorDeAmigos.Delete(id))&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Content(&lt;span style="color: #006080"&gt;&amp;quot;Error eliminando el registro&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Podréis observar que si se produce un error, retornamos un ContentResult describiendo el problema; en otros casos, devolvemos un nulo.&lt;/p&gt;&lt;p&gt;Para probar el funcionamiento de una eliminación errónea podéis, por ejemplo, abrir dos navegadores contra la aplicación, borrar un registro desde uno de ellos e intentar borrarlo también desde el otro.&lt;/p&gt;&lt;h4&gt;Y… ¡Voilá!&lt;/h4&gt;&lt;p&gt;Una vez habiendo implementado el modelo, la vista y el controlador, sólo nos queda probar la aplicación, que veremos que funciona perfectamente ;-P&lt;/p&gt;&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px auto 5px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="jqGrid+ASP.NET MVC en acción" border="0" alt="jqGrid+ASP.NET MVC en acción" src="http://lh3.ggpht.com/_O9D62hXq-ng/SvcaZTvqg4I/AAAAAAAABJ4/26kYGSQwk7I/image%5B13%5D.png?imgmax=800" width="526" height="447" /&gt;&lt;/p&gt;&lt;p&gt;Resumiendo, en este post hemos seguido profundizando en las capacidades de jqGrid, implementando paso a paso la funcionalidad de eliminación de registros. Hemos podido observar también el escaso código (¡a pesar de la longitud del post!) que hay que añadir para disponer de esta funcionalidad, y de lo sencillo y reutilizable que resulta su implementación.&lt;/p&gt;&lt;p&gt;Descargar proyecto de demostración:&lt;/p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="http://cid-c3a43a99b617d787.skydrive.live.com/embedicon.aspx/P%c3%bablico/variablenotfound.com/ASP.NET%20MVC/ASP.NET%20MVC%201.0/Demo%20jqGrid/jqGrid-MVC-Delete.zip" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-5009089461667406729?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/5009089461667406729/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=5009089461667406729' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5009089461667406729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5009089461667406729'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/borrado-de-registros-con-jqgrid-y.html' title='Borrado de registros con jqGrid y ASP.NET MVC'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-6343828662538438664</id><published>2009-11-23T11:07:00.001+01:00</published><updated>2009-11-23T11:10:06.820+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><category scheme='http://www.blogger.com/atom/ns#' term='componentes'/><title type='text'>Hojas con estilo usando .less</title><content type='html'>&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title=".Less: CSS Dinámicos para .NET" border="0" alt=".Less: CSS Dinámicos para .NET" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SwpcFEcnowI/AAAAAAAABKU/VSYHgx2KdrM/image%5B3%5D.png?imgmax=800" width="136" height="99" /&gt; Seguro que más de una vez has sufrido de lo lindo al tocar un archivo de hoja de estilos. Suelen estar mal organizados, ser muy extensos, difíciles de mantener, hay declaraciones duplicadas por todas partes… Y seguro que siempre te has preguntado si hay otra forma menos complicada de conseguir lo mismo.&lt;/p&gt;  &lt;p&gt;&lt;a title="K. Scott Allen" href="http://odetocode.com/Blogs/scott/default.aspx"&gt;K. Scott Allen&lt;/a&gt; nos habla en su post &lt;a title="Keeping CSS Files DRY with .less" href="http://odetocode.com/Blogs/scott/archive/2009/11/22/keeping-css-files-dry-with-less.aspx"&gt;Keeping CSS Files DRY&lt;/a&gt; de .Less (dot less), un interesante componente portado del mundo Ruby capaz de “compilar” hojas de estilo que utiliza una notación extendida y mucho más potente del estándar CSS, permitiendo las siguientes características:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Uso de variables. &lt;/strong&gt;Less permite declarar y utilizar variables para los valores que utilizaremos frecuentemente en nuestra hoja de estilos, así:       &lt;br /&gt;      &lt;br /&gt;      &lt;div&gt;       &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;         &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;@nice-blue: &lt;span style="color: #006080"&gt;#5B83AD;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;#header { &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: @light&lt;span style="color: #006080"&gt;-blue;&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;#footer { &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: @light&lt;span style="color: #006080"&gt;-blue;&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;Operaciones. &lt;/strong&gt;Podemos utilizar expresiones para obtener valores, por ejemplo:     &lt;br /&gt;    &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;@&lt;span style="color: #0000ff"&gt;base&lt;/span&gt;: &lt;span style="color: #006080"&gt;5%;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;@filler: @&lt;span style="color: #0000ff"&gt;base&lt;/span&gt; &lt;span style="color: #006080"&gt;* 2;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;@other: @&lt;span style="color: #0000ff"&gt;base&lt;/span&gt; + &lt;span style="color: #006080"&gt;@filler;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: #888 &lt;span style="color: #006080"&gt;/ 4;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;background-color&lt;/span&gt;: @&lt;span style="color: #0000ff"&gt;base&lt;/span&gt;-&lt;span style="color: #0000ff"&gt;color&lt;/span&gt; &lt;span style="color: #006080"&gt;+ #111;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;height&lt;/span&gt;: 100% / 2 + &lt;span style="color: #006080"&gt;@filler;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;Fijaos en un detalle de lo más interesante: Less es capaz de distinguir cuándo está operando con colores y cuándo con unidades, ofreciendo el resultado correcto en cada caso.&lt;br /&gt;       &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;Mezclas (mixins)&lt;/strong&gt;, otra potente capacidad de Less que seguro que puede venirnos bastante bien, que consiste en incluir dentro de un conjunto de reglas dentro de otro, sólo haciendo referencia a su selector: &lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #cc6633"&gt;.bordered&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;border&lt;/span&gt;-&lt;span style="color: #0000ff"&gt;top&lt;/span&gt;: &lt;span style="color: #006080"&gt;dotted 1px black;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;border&lt;/span&gt;-&lt;span style="color: #0000ff"&gt;bottom&lt;/span&gt;: &lt;span style="color: #006080"&gt;solid 2px black;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;#&lt;span style="color: #0000ff"&gt;menu&lt;/span&gt; a {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: &lt;span style="color: #006080"&gt;#111;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #006080"&gt;.bordered;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #cc6633"&gt;.post&lt;/span&gt; a {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: &lt;span style="color: #006080"&gt;red;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #006080"&gt;.bordered;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;Reglas anidadas, &lt;/strong&gt;que nos permiten definir reglas siguiendo una estructura más legible y fácilmente reconocible por su paralelismo con la estructura del documento:     &lt;br /&gt;    &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;#header {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: &lt;span style="color: #006080"&gt;black;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #cc6633"&gt;.navigation&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;font-size&lt;/span&gt;: &lt;span style="color: #006080"&gt;12px;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #cc6633"&gt;.logo&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;width&lt;/span&gt;: &lt;span style="color: #006080"&gt;300px;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    :hover { &lt;span style="color: #0000ff"&gt;text-decoration&lt;/span&gt;: none }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;Visibilidad de variables. &lt;/strong&gt;Las variables pueden ser declaradas de forma global (como en el primer ejemplo) o asociadas a algún selector, lo que les aporta ámbito de visibilidad de forma muy similar a los lenguajes tradicionales:  &lt;br /&gt;   &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;@&lt;span style="color: #0000ff"&gt;var&lt;/span&gt;: &lt;span style="color: #006080"&gt;red;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;#page {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  @&lt;span style="color: #0000ff"&gt;var&lt;/span&gt;: &lt;span style="color: #006080"&gt;white;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  #header {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: &lt;span style="color: #006080"&gt;@var;&lt;/span&gt; &lt;span style="color: #008000"&gt;// color será “white”&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;Accesores.&lt;/strong&gt; Less permite utilizar valores de propiedades y variables como contenido para otras propiedades de forma muy natural:&lt;br /&gt;     &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;#defaults {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  @&lt;span style="color: #0000ff"&gt;width&lt;/span&gt;: &lt;span style="color: #006080"&gt;960px;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  @&lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: &lt;span style="color: #006080"&gt;black;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #cc6633"&gt;.article&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: &lt;span style="color: #006080"&gt;#294366;&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #cc6633"&gt;.comment&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;width&lt;/span&gt;: #defaults[@&lt;span style="color: #0000ff"&gt;width&lt;/span&gt;];&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;color&lt;/span&gt;: &lt;span style="color: #cc6633"&gt;.article&lt;/span&gt;['&lt;span style="color: #0000ff"&gt;color&lt;/span&gt;']; &lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;Fijaos que el bloque #defaults no tiene por qué corresponder con un elemento del documento a formatear, se trata sólo de una forma de agrupar variables y reglas, consiguiendo un efecto empaquetador muy similar a los espacios de nombres.&lt;br /&gt;       &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;Comentarios en línea&lt;/strong&gt;, al más puro estilo C++ ó C#: &lt;br /&gt;    &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Get in line!&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;@&lt;span style="color: #0000ff"&gt;var&lt;/span&gt;: &lt;span style="color: #006080"&gt;white;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;li&gt;&lt;strong&gt;Importación de archivos&lt;/strong&gt;, permitiendo acceder a reglas y variables definidas en otros archivos: &lt;br /&gt;    &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #006080"&gt;@import &amp;quot;library&amp;quot;;&lt;/span&gt; &lt;span style="color: #008000"&gt;// Si la extensión es .less, se puede omitir&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #006080"&gt;@import &amp;quot;typo.css&amp;quot;;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;/div&gt;  &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;¿Y cómo funciona esto? Muy sencillo. En primer lugar, escribimos la hoja de estilos en un archivo .less, en el que podemos utilizar las características descritas anteriormente, y lo incluimos en las páginas donde nos interese, como lo hacemos siempre:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;link&lt;/span&gt; &lt;span style="color: #ff0000"&gt;href&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/Content/estilos.less&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;rel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;stylesheet&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text/css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Es interesante tener en cuenta que Less es compatible con CSS, lo que quiere decir que si simplemente renombramos el .css a .less, ya tendremos una hoja de partida.&lt;/p&gt;&lt;p&gt;A continuación, debemos introducir en el web.config una declaración que asocie la extensión .css al compilador Less:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;httpHandlers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;validate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;path&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;*.less&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;verb&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;dotless.Core.LessCssHttpHandler, dotless.Core&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;httpHandlers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Cuando llega una petición, el handler se encargará de compilar el archivo .less, generar el .css correspondiente y enviarlo minimizado al cliente, cacheando el resultado para posteriores usos, si se lo indicamos en la configuración, una sección opcional del web.config.&lt;/p&gt;&lt;p&gt;.Less está diseñado para ASP.NET 3.5 o superior, y por supuesto, es válido tanto para Webforms como para ASP.NET MVC. Se distribuye bajo licencia &lt;a title="Licencia Apache 2.0" href="http://www.apache.org/licenses/LICENSE-2.0.html"&gt;Apache 2.0&lt;/a&gt;, y está aún en fase beta, por lo que habrá que estar atento a la evolución de este interesantísimo proyecto.&lt;/p&gt;&lt;p&gt;Enlaces:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;&lt;a title="Home del proyecto" href="http://www.dotlesscss.com/" hreflang="en"&gt;Home del proyecto&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a title=".Less source code" href="http://github.com/chrisjowen/nLess" hreflang="en"&gt;Descargar el código fuente de nLess en Github&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a title="Documentación de Less" href="http://lesscss.org/docs.html" hreflang="en"&gt;Documentación de Less&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-6343828662538438664?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/6343828662538438664/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=6343828662538438664' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/6343828662538438664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/6343828662538438664'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/hojas-con-estilo-usando-less.html' title='Hojas con estilo usando .less'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-49284111820357072</id><published>2009-11-18T14:07:00.002+01:00</published><updated>2009-11-18T16:36:21.868+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='novedades'/><category scheme='http://www.blogger.com/atom/ns#' term='noticias'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><title type='text'>Publicado ASP.NET MVC 2 Beta</title><content type='html'>&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 5px; display: inline; border-top: 0px; border-right: 0px" title="mvc-logo-landing-page" border="0" alt="mvc-logo-landing-page" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SwPxub91QFI/AAAAAAAABJ8/7R-25WJBv5Q/mvc-logo-landing-page%5B4%5D.png?imgmax=800" width="142" height="77" /&gt;Hace sólo unas horas &lt;a title="ASP.NET MVC 2 beta released" href="http://haacked.com/archive/2009/11/17/asp.net-mvc-2-beta-released.aspx"&gt;Haack&lt;/a&gt; ha anunciado en su blog la publicación de la versión beta del&amp;#160; framework ASP.NET MVC 2, que tenemos a nuestra disposición tanto a nivel de &lt;a title="ASP.NET MVC 2 Beta source code, en Codeplex" href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36054"&gt;código fuente&lt;/a&gt; como de &lt;a title="Descargar instalador de ASP.NET MVC 2 Beta para VS2008 SP1" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=4817cdb2-88ea-4af4-a455-f06b4c90fd2c&amp;amp;displaylang=en"&gt;instalador binario&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Echando un vistazo rápido a las &lt;em&gt;release notes&lt;/em&gt;, las novedades son:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;introducción de los nuevos métodos &lt;code&gt;Html.RenderAction()&lt;/code&gt; y &lt;code&gt;Html.Action()&lt;/code&gt;, el primero de ellos para escribir directamente la salida resultado de ejecutar la acción dada, y el segundo para obtenerla como cadena.&lt;/li&gt;    &lt;li&gt;helpers para la generación de controles de edición en las vistas, basados en expresiones lambda o, en otras palabras, con tipado fuerte: &lt;code&gt;ValidationMessageFor()&lt;/code&gt;, &lt;code&gt;TextAreaFor()&lt;/code&gt;, &lt;code&gt;TextBoxFor()&lt;/code&gt;, &lt;code&gt;HiddenFor()&lt;/code&gt;y &lt;code&gt;DropDownListFor()&lt;/code&gt;.&lt;/li&gt;    &lt;li&gt;mejoras en TempDataDictionary, destinadas a controlar de forma más pormenorizada la persistencia de los datos.&lt;/li&gt;    &lt;li&gt;se incluyen las librerías de validación en cliente, MicrosoftAjax.js y MicrosoftMvcAjax.js. Para utilizar este automatismo, sólo hay que incluir ambos script en la vista (o master) e invocar al método de activación: &lt;code&gt;&amp;lt;% Html.EnableClientValidation(); %&amp;gt;.&lt;/code&gt;&lt;/li&gt;    &lt;li&gt;&lt;code&gt;&lt;/code&gt;Visual Studio incorpora ahora una opción “Add Area” en el menú contextual, así como un cuadro de diálogo para crearlas.&lt;/li&gt;    &lt;li&gt;es posible crear controladores de ejecución asíncrona heredando de la clase &lt;code&gt;AsyncController&lt;/code&gt;. Esto permite crear acciones que se ejecuten en segundo plano, sin bloquear el hilo principal.&lt;/li&gt;    &lt;li&gt;nueva plantilla de proyectos en blanco, es decir, sin toda la parafernalia de las plantillas actuales (páginas de ejemplo, autenticación, etc.).&lt;/li&gt;    &lt;li&gt;capacidad para registrar múltiples proveedores de validación, permitiéndonos adoptar otras soluciones o frameworks, o crear nuestras propias opciones.&lt;/li&gt;    &lt;li&gt;separación del proveedor de datos, el componente utilizado para obtener datos del contexto, en subcomponentes especializados en función del origen de la información (formularios, ruta, cadena de petición, y archivos). También existe la posibilidad de crear proveedores personalizados.&lt;/li&gt;    &lt;li&gt;Y otras mejoras, de menor calado, citadas de forma concisa en las notas de la revisión, como:&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;adición de nuevos métodos y propiedades a la clase &lt;code&gt;ModelMetadata&lt;/code&gt;.&lt;/li&gt;      &lt;li&gt;cambios en la plantilla por defecto de las vistas para generar los controles utilizando los nuevos helpers.&lt;/li&gt;      &lt;li&gt;helpers con soporte para datos binarios en el modelo, generando automáticamente campos ocultos codificados en Base64.&lt;/li&gt;      &lt;li&gt;etc.&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;Y ojo, que esta beta sólo funciona con Visual Studio 2008 SP1, no podemos probarla con la última beta de Visual Studio 2010. Eso sí, puede convivir en nuestros equipos con MVC 1.0 sin interferencias.&lt;/p&gt;  &lt;p&gt;El siguiente paso será la publicación de la RC, que está prevista “antes de finalizar el año”, aunque no se planea incluir funcionalidades nuevas, simplemente corregir bugs y pequeñas mejoras que puedan derivar de esta fase de pruebas y del feedback de los usuarios. Por tanto, en líneas generales, lo que nos trae esta beta será prácticamente lo que vendrá en la versión 2 :-)&lt;/p&gt;  &lt;p&gt;Enlaces:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="Instalación de ASP.NET MVC 2 beta" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=4817cdb2-88ea-4af4-a455-f06b4c90fd2c&amp;amp;displaylang=en" hreflang="en"&gt;Instalación de ASP.NET MVC 2 beta&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="Código fuente de ASP.NET MVC 2 beta y ensamblado futures, en Codeplex" href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36054" hreflang="en"&gt;Código fuente de ASP.NET MVC 2 beta y ensamblado futures, en Codeplex&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a title="Documento de notas de la revisión" href="http://go.microsoft.com/fwlink/?LinkID=157069" hreflang="en"&gt;Documento de notas de la revisión&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-49284111820357072?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/49284111820357072/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=49284111820357072' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/49284111820357072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/49284111820357072'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/publicado-aspnet-mvc-2-beta.html' title='Publicado ASP.NET MVC 2 Beta'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-5907667312330929706</id><published>2009-11-16T17:17:00.006+01:00</published><updated>2009-11-16T19:19:56.717+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='antipatrones'/><category scheme='http://www.blogger.com/atom/ns#' term='buenas prácticas'/><category scheme='http://www.blogger.com/atom/ns#' term='humor'/><category scheme='http://www.blogger.com/atom/ns#' term='interfaces'/><category scheme='http://www.blogger.com/atom/ns#' term='patrones'/><title type='text'>Indicios de que tu interfaz de usuario fue creado por un programador</title><content type='html'>&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="¡Programadiseñadores al poder!" border="0" alt="¡Programadiseñadores al poder!" align="right" src="http://lh3.ggpht.com/_O9D62hXq-ng/SvRMRL6iHxI/AAAAAAAABJM/EwNeAsKvkLc/image3.png?imgmax=800" width="208" height="146" /&gt; Ya sabemos lo que suele ocurrir &lt;a title="Lo que ocurre cuando desarrolladores diseñan interfaces de usuario" href="http://www.variablenotfound.com/2006/12/lo-que-ocurre-cuando-desarrolladores.html" target="_blank"&gt;cuando los programadores diseñamos interfaces de usuario&lt;/a&gt; ;-). Para seguir profundizando en este curioso &lt;strike&gt;e inevitable&lt;/strike&gt; fenómeno, Ian Voyce ha publicado hace unas semanas el divertido post &lt;a title="The 7 signs your UI was created by a programmer" href="http://www.voyce.com/index.php/2009/09/14/the-7-signs-your-ui-was-created-by-a-programmer/"&gt;The 7 signs your UI was created by a programmer&lt;/a&gt;, en el que recoge pistas que nos ayudarán a determinar si el interfaz de la aplicación que usamos a diario está creado por un diseñador experto en usabilidad, o ha sido el propio desarrollador el encargado de dichas tareas.&lt;/p&gt;  &lt;p&gt;Bueno, en realidad se trata más bien de una lista con malos hábitos en el diseño de interfaces, y no necesariamente creados por programadores, pero ciertamente me he reconocido en alguno de los puntos y me han hecho gracia. Los cito y comento a continuación:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Iconos de exclamación en cuadros de diálogo        &lt;br /&gt;&lt;/strong&gt;Efectivamente, cuando incluimos una exclamación en un cuadro de diálogo no pensamos en que es posible que el usuario vea el mensaje 50 veces al día, con lo que dejaría de ser ese mensaje asombroso y puntual que pensamos en un principio. Hoy en día, muchas aplicaciones utilizan un tono mucho más neutral y cercano para enviar mensajes al usuario.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Mensajes con dobles negaciones en cuadros de diálogo&lt;/strong&gt;, del tipo “¿Seguro de que no quieres perder tus cambios?” -- Hmm… sí… digooo, no…&amp;#160; También son muy propias construcciones más complejas de la cuenta, paradójicas o inesperadas, como “Su mensaje no se ha enviado, ¿desea descartarlo?”, que ponen a prueba los reflejos de cualquier usuario.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Orden de tabulación inexistente&lt;/strong&gt;, o incorrecto, que fuerzan a que la navegación se realice exclusivamente a golpe de ratón. Y especialmente en aplicaciones de entrada masiva de información, el cambio de teclado a ratón y viceversa es terrible. Y para&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Groupboxes para todo.. porque mola" border="0" alt="Groupboxes para todo.. porque mola" align="right" src="http://lh5.ggpht.com/_O9D62hXq-ng/SvRMRm9mzXI/AAAAAAAABJQ/NZ5L1y9aJkY/image%5B7%5D.png?imgmax=800" width="172" height="156" /&gt; hacernos conscientes de ello, nada como dar vacaciones un rato al animalito y ver lo bien que manejamos determinadas aplicaciones.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Groupboxes rodeándolo todo&lt;/strong&gt;… porque hay sitios donde queda bonito, aunque no esté agrupando nada ;-). Me confieso: durante años, he rodeado de groupboxes todo lo que se me ponía por delante, porque me parecía más agradable a la vista. Ahora lo estoy dejando ;-)       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Icono" border="0" alt="Icono" align="right" src="http://lh4.ggpht.com/_O9D62hXq-ng/SvRMSerKM1I/AAAAAAAABJU/ds-oYq8Mg50/image%5B18%5D.png?imgmax=800" width="118" height="118" /&gt;&lt;strong&gt;Iconos creados en el IDE&lt;/strong&gt;, je, este es otro de mis puntos fuertes: soy un fiera diseñando iconos desde el editor de Visual Studio. El problema es que, a pesar de lo orgulloso que estoy siempre de mis creaciones artísticas, no quedan bien e incluso introducen un cierto tufillo a cutre en las aplicaciones.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Utilización de grids&lt;/strong&gt;, debido a lo que llama Voyce “la enfermedad de considerar que Excel es lo máximo en diseño de interfaces de usuario”, que fomenta la creación de rejillas con controles de lo más potentes y variopintos en las filas de datos (calendarios, gráficos, etc.).       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Message Boxes no implementados&lt;/strong&gt;, el equivalente en los interfaces de usuario a los TODO en el código fuente :-DD. Buena analogía. Algo parecidos serían los mensajes del tipo “Este mensaje no debería aparecer nunca” que alguna vez he encontrado por ahí, auténticos actos de rebeldía contra sus respectivos creadores.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Uso excesivo de cuadros de diálogo&lt;/strong&gt;, incluso en situaciones en las que perfectamente podríamos obviarlos por no ofrecer información útil para el usuario, que no va a poder entender, o donde no se requieren decisiones por su parte.       &lt;br /&gt;      &lt;br /&gt;&lt;img style="border-right-width: 0px; margin: 5px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Los componentes necesarios han sido detectados. Accediendo..." border="0" alt="Los componentes necesarios han sido detectados. Accediendo..." align="right" src="http://lh3.ggpht.com/_O9D62hXq-ng/SvRMS4VDKlI/AAAAAAAABJY/hKvV-ZQbtxQ/image%5B19%5D.png?imgmax=800" width="255" height="85" /&gt;Esto es algo muy frecuente de ver. Por ejemplo, el otro día accediendo a una aplicación web para la que es necesario contar con certificado digital, me saltó la alerta que muestro a la derecha:       &lt;br /&gt;      &lt;br /&gt;Sí, probablemente los componentes Java necesarios para la autenticación y firma electrónica hayan sido detectados con éxito, pero… ¿realmente era necesario interrumpir mi navegación para informarme de ello? ¿Un usuario, sabrá interpretar el mensaje? Y en cualquier caso, ¿le aporta algo? No sé, no sé… me da que es un &lt;code&gt;alert()&lt;/code&gt; creado por un desarrollador durante las pruebas y que al final se quedó ahí para la posteridad. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Hasta aquí las citadas en el post original, aunque siguiendo en la misma línea, puedo añadir algunas más de propia cosecha:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Cuadros de diálogo con mensajes y botones inconsistentes. &lt;/strong&gt;Mensajes del tipo “¿desea cancelar la operación?” en cuyo pie aparece un botón “Aceptar” y otro “Cancelar” siempre me dejan pensando un rato. Si pulso aceptar, ¿estoy aceptando la cancelación, o justo lo contrario?… Muchas veces, parece que sólo podemos confiar en el azar.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Cuadros de mensaje con demasiados (o demasiados pocos) botones. &lt;/strong&gt;No siempre atendemos a la &lt;a title="Hick&amp;#39;s Law, en la wikipedia" href="http://en.wikipedia.org/wiki/Hick's_law" hreflang="en" target="_blank"&gt;Ley de Hick&lt;/a&gt;, que nos dice que &lt;em&gt;“el tiempo que se tarda en tomar una decisión aumenta a medida que se incrementa el número de alternativas”&lt;/em&gt;, y eso nos lleva a crear cuadros de diálogo con muchos, demasiados, botones que el usuario debe estudiar.       &lt;br /&gt;      &lt;br /&gt;Y justo en el lado contrario, pero igualmente desconcertantes, son los cuadros de diálogo de introducción de datos sin ningún botón de aceptación, en los que su cierre (con la X de la esquina superior) implica el salvado de datos.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Interfaz descuidado. &lt;/strong&gt;Y no hablo de bonito o feo, términos bastante subjetivos, sino de &lt;em&gt;descuidado&lt;/em&gt;: controles sin alinear, con tamaños no proporcionales al contenido pretendido, sensación de desorden, faltas de ortografía… Esto no es un problema de interfaces creados por desarrolladores, sino creados por gente que no pone el más mínimo cariño en lo que hace, independientemente de su puesto de trabajo.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Interfaces monocromos&lt;/strong&gt;, mi especialidad. Como inútil reconocido en temas de diseño, me considero absolutamente incapaz de crear algo medio aparente con más de un color (eso sí, empleando distintas tonalidades ;-)). Nunca he entendido la compleja lógica que hay detrás del “eso no pega con aquello”, que algunos/as parecen dominar de serie.       &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Controles con trastorno de personalidad&lt;/strong&gt;. Un clásico es encontrar un grupo de checkboxes actuando como un grupo de radios. A ver, si sólo vamos a poder elegir una de las opciones, ¿por qué no usamos directamente el control específicamente ideado para ello? ¿Y un desplegable con las opciones "Activar" y "Desactivar"? ¿No sería más claro poner un checkbox?&lt;p /&gt;&lt;/li&gt; &lt;/ul&gt;&lt;p&gt;Artículo original: &lt;a title="The 7 signs your UI was created by a programmer" href="http://www.voyce.com/index.php/2009/09/14/the-7-signs-your-ui-was-created-by-a-programmer/"&gt;The 7 signs your UI was created by a programmer&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-5907667312330929706?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/5907667312330929706/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=5907667312330929706' title='5 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5907667312330929706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5907667312330929706'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/indicios-de-que-tu-interfaz-de-usuario.html' title='Indicios de que tu interfaz de usuario fue creado por un programador'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-1218971168324897148</id><published>2009-11-11T23:59:00.000+01:00</published><updated>2009-11-11T23:59:00.436+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='trucos'/><title type='text'>Cómo obtener el valor de campos de formulario con el mismo nombre</title><content type='html'>&lt;p&gt;Imaginemos el siguiente código HTML:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;input&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;nombre&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;input&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;nombre&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Si desde un servidor ASP.NET, como respuesta a un submit (o postback en webforms), queremos acceder a los valores del campo del formulario “nombre”, podemos utilizar el clásico Request[“nombre”] para obtener los valores de todos ellos separados por comas.&lt;/p&gt;&lt;p&gt;Así, si introducimos en el primer campo el valor “Juan” y en el segundo “Pedro”, &lt;code&gt;Request[&amp;quot;nombre&amp;quot;]&lt;/code&gt; contendrá “Juan,Pedro”. Esto podría ser suficiente para procesarlo troceando la cadena a partir de las comas, por ejemplo así:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] nombres = Request[&lt;span style="color: #006080"&gt;&amp;quot;nombre&amp;quot;&lt;/span&gt;].Split(&lt;span style="color: #006080"&gt;','&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; n1 = nombres[0]; &lt;span style="color: #008000"&gt;// n1 = &amp;quot;Juan&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; n2 = nombres[1]; // n2 = &lt;span style="color: #006080"&gt;&amp;quot;Pedro&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Sin embargo, es obvio que esta técnica genera problemas si un usuario introduce en alguno de los campos una coma, el carácter que estamos considerando como separador de los elementos.&lt;/p&gt;&lt;p&gt;La forma correcta de hacerlo sería utilizando el método &lt;code&gt;GetValues()&lt;/code&gt; sobre la propiedad &lt;code&gt;Form&lt;/code&gt; de la petición, la cual nos devuelve un array con los valores de cada campo. Por ejemplo, si en el primer campo introducimos “Juan,Jose” y en el segundo “Luis”, el resultado sería el que sigue:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] nombres = Request.Form.GetValues(&lt;span style="color: #006080"&gt;&amp;quot;nombre&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; n1 = nombres[0]; &lt;span style="color: #008000"&gt;// Juan,Jose&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; n2 = nombres[1]; &lt;span style="color: #008000"&gt;// Luis&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;En ASP.NET MVC, el sistema de bindings es capaz de facilitarnos aún más las cosas. Si en la vista existen diferentes campos llamados “nombre”, y el submit se realiza sobre una acción en cuyos parámetros aparece un array con la misma denominación, recibiremos los datos directamente:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;[AcceptVerbs(HttpVerbs.Post)]&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Editar(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] nombre)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// nombre[0] -&amp;gt; &amp;quot;Juan,Jose&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// nombre[1] -&amp;gt; &amp;quot;Luis&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-1218971168324897148?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/1218971168324897148/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=1218971168324897148' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1218971168324897148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1218971168324897148'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/como-obtener-el-valor-de-campos-de.html' title='Cómo obtener el valor de campos de formulario con el mismo nombre'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-4359770668533141842</id><published>2009-11-09T00:12:00.002+01:00</published><updated>2009-11-09T11:24:07.243+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='buenas prácticas'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><title type='text'>12 buenas prácticas en ASP.NET MVC</title><content type='html'>&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 5px; display: inline; border-top: 0px; border-right: 0px" title="ASP.NET MVC" border="0" alt="image" align="right" src="http://lh3.ggpht.com/_O9D62hXq-ng/SuhvR8CjCjI/AAAAAAAABI4/yjorBrcLFbc/image%5B3%5D.png?imgmax=800" width="179" height="95" /&gt;Simone Chiaretta, desarrollador, MVP, bloguero y autor de un &lt;a href="http://www.amazon.com/gp/product/047043399X?ie=UTF8&amp;tag=variabnotfoun-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047043399X" title="Beginning ASP.NET MVC 1.0 en Amazon"&gt;libro sobre ASP.NET MVC Framework&lt;/a&gt;, entre otros méritos, recoge en su recomendable bitácora &lt;a title="Code Climber" href="http://codeclimber.net.nz/" hreflang="en" target="_blank"&gt;Code Climber&lt;/a&gt; unas cuantas &lt;a title="12 ASP.NET MVC best practices" href="http://codeclimber.net.nz/archive/2009/10/27/12-asp.net-mvc-best-practices.aspx" target="_blank"&gt;buenas prácticas&lt;/a&gt; a considerar cuando trabajamos en proyectos &lt;a title="13 preguntas básicas sobre ASP.NET MVC" href="http://www.variablenotfound.com/2009/04/aspnet-mvc-trece-preguntas-basicas.html" target="_blank"&gt;ASP.NET MVC&lt;/a&gt;, que cito y comento a continuación:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Borra el AccountController. &lt;/strong&gt;Siendo fieles al principio &lt;a title="¡No vas a necesitarlo!" href="http://es.wikipedia.org/wiki/No_vas_a_necesitarlo_(YAGNI)" target="_blank"&gt;YAGNI&lt;/a&gt;, prácticamente lo primero que deberíamos hacer al crear un proyecto ASP.NET MVC es eliminar todo lo relativo al sistema de cuentas de usuario incluido por defecto en el mismo, que muy difícilmente nos será útil tal cual en proyectos reales.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Aísla los controladores del mundo exterior&lt;/strong&gt;, no dejes que dependan de elementos externos como &lt;code&gt;HttpContext&lt;/code&gt;,&amp;#160; datos del reloj (hora/fecha actual), ni accedas directamente a bases de datos o elementos de configuración. Harán tu aplicación muy poco flexible y difícil de testear.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Utiliza un contenedor IoC&lt;/strong&gt;, te ayudará a gestionar las dependencias de los controladores, facilitando la sustitución de estos elementos de forma muy sencilla, sobre todo, vistas a la realización de pruebas.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;No utilices cadenas mágicas&lt;/strong&gt;, dificultan la detección de errores. No es buena idea usar expresiones del tipo &lt;code&gt;ViewData[&amp;quot;variable&amp;quot;]&lt;/code&gt;, las vistas tipadas son el mecanismo ideal para pasar información desde el controlador. También es peligroso el uso de los helpers que utilizan cadenas para referirse a nombres de controladores y acciones, y para ello existen alternativas basadas en expresiones lambda o &lt;a title="T4 MVC" href="http://blogs.msdn.com/davidebb/archive/2009/10/15/t4mvc-2-4-04-update-mvc-2-support-new-settings-cleanup-fixes.aspx" hreflang="en" target="_blank"&gt;plantillas T4&lt;/a&gt; bastante potentes.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Crea tus propias convenciones&lt;/strong&gt; tomando como base las propuestas por el framework MVC. Por ejemplo, crea controladores y vistas base de las que heredar, e implementa en ellos aspectos comunes.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Presta atención a los Verbos&lt;/strong&gt;, a los verbos HTTP, claro ;-). Envía información desde formularios con el método POST y genera las vistas que muestran datos desde peticiones GET. Utiliza el patrón &lt;a title="El patrón Post-Redirect-Get" href="http://www.variablenotfound.com/2009/11/el-patron-post-redirect-get.html"&gt;Post-Redirect-Get&lt;/a&gt;.&lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;DomainModel != ViewModel,&lt;/strong&gt; el primero representa los datos y lógica del dominio, mientras que el segundo se diseña exclusivamente para satisfacer las necesidades de información de las vistas y normalmente serán estructuras planas, y principalmente strings, que es el tipo de datos que normalmente necesitan los controles de entrada y salida de datos.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Usa ActionFilters para manejar los datos compartidos&lt;/strong&gt; entre distintas acciones y controladores, dejando que éstos se centren en la tarea que deben realizar. Puedes utilizar filtros para cargar información común (por ejemplo, para componentes de una página maestra) y utilizar vistas parciales para mostrarla.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;No utilices el code-behind&lt;/strong&gt;. Nunca. En mi opinión, el code-behind no es necesario (al menos no le he encontrado aún ninguna utilidad en MVC), y puede crear confusión si compartes tu código con otros desarrolladores que no esperarán encontrar nada ahí.      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Escribe HTML siempre que puedas.&lt;/strong&gt; No utilices helpers que lo único que van a hacer es generar el código HTML por ti. Es decir, mejor usar &lt;code&gt;&amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;grabar&amp;quot; /&amp;gt;&lt;/code&gt; que &lt;code&gt;&amp;lt;%=Html.Submit(&amp;quot;grabar&amp;quot;) %&amp;gt;.       &lt;p /&gt;&lt;/code&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Si hay un if, escribe un helper&lt;/strong&gt;. Las vistas deben ser fáciles de leer, y muchos bloques de códigos mezclados con marcado no facilita la tarea. Dado que en las vistas la lógica ha de ser necesariamente muy simple, probablemente puedas crear helpers que simplifiquen la composición del marcado en casos en los que hay condiciones &lt;code&gt;if&lt;/code&gt; o bucles &lt;code&gt;for&lt;/code&gt; .      &lt;p /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Elige el motor de vistas cuidadosamente&lt;/strong&gt;, WebFormViewEngine no es el único ni, para Simone, el mejor de los existentes. De hecho, recomienda el uso de &lt;a title="Spark View Engine" href="http://sparkviewengine.com/" hreflang="en" target="_blank"&gt;Spark&lt;/a&gt;, un motor de vistas libre en el que es el propio HTML el que controla el flujo de composición del interfaz de forma muy sencilla y potente:      &lt;p /&gt;&lt;/li&gt;    &lt;div id="page"&gt;     &lt;div id="section1" class="clear-block clr"&gt;       &lt;div class="sections"&gt;         &lt;div class="section width49"&gt;           &lt;div id="block-block-3" class="block block-block unstyled-block"&gt;             &lt;div class="content"&gt;               &lt;div id="codeSnippetWrapper"&gt;                 &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;                   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;viewdata&lt;/span&gt; &lt;span style="color: #ff0000"&gt;products&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;IEnumerable[[Product]]&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;                  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ul&lt;/span&gt; &lt;span style="color: #ff0000"&gt;if&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;products.Any()&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;                  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;li&lt;/span&gt; &lt;span style="color: #ff0000"&gt;each&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;var p in products&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;${p.Name}&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;li&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;                  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ul&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;                  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;else&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;                  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;No products available&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;                  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;else&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;              &lt;/div&gt;              &lt;div&gt;&amp;#160;&lt;/div&gt;              &lt;div&gt;En mi caso, todavía no he encontrado motivos suficientes como para dar el salto a un motor de vistas distinto de WebForms. Sinceramente, no me parece tan aberrante ver código y marcado dentro del mismo archivo, siempre teniendo en cuenta que la lógica que debe aparecer en estos puntos debe ser siempre relativa a la presentación y, por tanto, simplísima.&lt;/div&gt;            &lt;/div&gt;          &lt;/div&gt;        &lt;/div&gt;      &lt;/div&gt;    &lt;/div&gt;  &lt;/div&gt;&lt;/ol&gt;&lt;p&gt;Opiniones aparte, la verdad es que es un interesante grupo de consejos a tener en cuenta.&lt;/p&gt;&lt;p&gt;Fuente: &lt;a title="12 ASP.NET MVC Best Practices" href="http://codeclimber.net.nz/archive/2009/10/27/12-asp.net-mvc-best-practices.aspx" target="_blank"&gt;12 ASP.NET MVC Best Practices&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-4359770668533141842?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/4359770668533141842/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=4359770668533141842' title='4 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/4359770668533141842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/4359770668533141842'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/12-buenas-practicas-en-aspnet-mvc.html' title='12 buenas prácticas en ASP.NET MVC'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-1937351189211316288</id><published>2009-11-04T00:12:00.000+01:00</published><updated>2009-11-04T00:12:00.093+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vb.net'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='trucos'/><title type='text'>Cadenas nulas, vacías o en blanco</title><content type='html'>&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Cadenas" border="0" alt="Cadenas" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SuWAOC5QCII/AAAAAAAABIo/DXeNGUPTs7g/image%5B4%5D.png?imgmax=800" width="185" height="132" /&gt; Encuentro en el blog de &lt;a title=".Net Framework 4.0 string.IsNullOrWhiteSpace() method - Gunnar Peipman&amp;#39;s ASP.NET blog" href="http://weblogs.asp.net/gunnarpeipman/archive/2009/10/25/net-framework-4-0-string-isnullorwhitespace-method.aspx" hreflang="en"&gt;Gunnar Peipman&lt;/a&gt;&lt;a title=".Net Framework 4.0 string.IsNullOrWhiteSpace() method - Gunnar Peipman&amp;#39;s ASP.NET blog" href="http://weblogs.asp.net/gunnarpeipman/archive/2009/10/25/net-framework-4-0-string-isnullorwhitespace-method.aspx"&gt;&lt;/a&gt; un post sobre el nuevo método &lt;a title="string.IsNullOrWhiteSpace en MSDN" href="http://msdn.microsoft.com/en-us/library/system.string.isnullorwhitespace(VS.100).aspx"&gt;&lt;/a&gt;&lt;a title="string.IsNullOrWhiteSpace en MSDN" href="http://msdn.microsoft.com/en-us/library/system.string.isnullorwhitespace(VS.100).aspx" hreflang="en"&gt;string.IsNullOrWhiteSpace&lt;/a&gt;, aparecido en .NET Framework 4.0 Beta 2, cuya misión es retornar un booleano indicando si la cadena pasada como parámetro contiene un nulo, está vacío, o exclusivamente caracteres de espaciado (espacios, saltos de línea, tabulaciones, etc.), un escenario bastante frecuente cuando estamos, por ejemplo, validando formularios o cualquier tipo de datos de entrada.&lt;/p&gt;  &lt;p&gt;Por si no podemos esperar hasta la llegada de la nueva versión del framework, Gunnar propone una solución temporal basada en crear un &lt;a title="Métodos de extensión en C#" href="http://www.variablenotfound.com/2008/02/mtodos-de-extensin-en-c.html"&gt;método de extensión&lt;/a&gt; sobre la clase &lt;code&gt;string&lt;/code&gt; que realice la misma tarea:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; StringHelper&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; IsNullOrWhiteSpace(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; s)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (s == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; (s.Trim() == &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Empty);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;div&gt;Como ya &lt;a title="Saber si una cadena está vacía utilizando métodos de extensión" href="http://www.variablenotfound.com/2008/02/saber-si-una-cadena-est-vaca-usando.html"&gt;comenté por aquí&lt;/a&gt; hace tiempo, la ventaja que tiene utilizar esta técnica es que permite invocar el método sobre una instancia de cadena, aunque ésta sea nula, sin riesgo a errores:&lt;/div&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; a = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; b = &lt;span style="color: #006080"&gt;&amp;quot;    &amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; c = &lt;span style="color: #006080"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; d = &lt;span style="color: #006080"&gt;&amp;quot;Hey!&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;Console.Write (a.IsNullOrWhiteSpace()); &lt;span style="color: #008000"&gt;// True&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;Console.Write (b.IsNullOrWhiteSpace()); &lt;span style="color: #008000"&gt;// True&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;Console.Write (c.IsNullOrWhiteSpace()); &lt;span style="color: #008000"&gt;// True&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;Console.Write (d.IsNullOrWhiteSpace()); &lt;span style="color: #008000"&gt;// False&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Y para los fieles a Visual Basic .NET, ahí va el código equivalente:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Imports&lt;/span&gt; System.Runtime.CompilerServices&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Module&lt;/span&gt; StringHelper&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;Extension()&amp;gt; _&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt; IsNullOrWhiteSpace(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; s &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Boolean&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; s &lt;span style="color: #0000ff"&gt;Is&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt; &lt;font color="#0000ff"&gt;True&lt;/font&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt; s.Trim() = &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;.Empty&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Module&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-1937351189211316288?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/1937351189211316288/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=1937351189211316288' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1937351189211316288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1937351189211316288'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/cadenas-nulas-vacias-o-en-blanco.html' title='Cadenas nulas, vacías o en blanco'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-6718055733302509787</id><published>2009-11-02T23:50:00.001+01:00</published><updated>2009-11-03T09:52:55.671+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='buenas prácticas'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='patrones'/><title type='text'>El patrón Post-Redirect-Get</title><content type='html'>&lt;p&gt;Hoy vamos a dedicar un rato a comentar una técnica que es considerada una buena práctica en el desarrollo de aplicaciones web: el patrón PRG o Post-Redirect-Get. Seguramente alguna vez lo haya citado por aquí, pero nunca lo había explicado en profundidad.&lt;/p&gt;  &lt;p&gt;Por último, antes de entrar en materia, es conveniente indicar que lo que vamos a ver es válido para ASP.NET Webforms, ASP.NET MVC y, en general, para cualquier tecnología de construcción de sitios web que incluya componentes en servidor, puesto que se trata de una forma de hacer las cosas, no de la implementación de una solución. Ya en el último epígrafe veremos implementaciones concretas para Webforms y el framework MVC.&lt;/p&gt;  &lt;h4&gt;El problema&lt;/h4&gt;  &lt;p&gt;Es bastante habitual que al desarrollar aplicaciones para la web creemos un formulario de introducción de datos, y lo normal es que estos envíen los datos al servidor utilizando el verbo HTTP Post. Hasta aquí, bien.&lt;/p&gt;  &lt;p&gt;Cuando desde el servidor se recibe una petición de este tipo normalmente se ejecuta un código, por ejemplo para almacenar la información en la base de datos y, de forma bastante frecuente, aprovechamos para enviar al cliente feedback de que su operación ha sido realizada con éxito. Y aquí es donde aparece el problema.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 5px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://lh5.ggpht.com/_O9D62hXq-ng/SuiTd811QqI/AAAAAAAABI8/0grC6w7Qqmk/image%5B3%5D.png?imgmax=800" width="322" height="147" /&gt; Si el usuario, por esas ocurrencias que suele tener ;-), decide pulsar F5 o actualizar la página en el navegador, se van a producir dos efectos desagradables:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;primero, se le mostrará al usuario un cuadro de diálogo informándolo de algo que difícilmente va a entender y que, en cualquier caso, le asustará bastante. El navegador le informa de que está realizando un reenvío completo de los datos del formulario.     &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;segundo, una vez superado el escollo anterior, se volvería a ejecutar en servidor toda la lógica asociada a la recepción de datos del formulario con consecuencias, a veces terribles, como el almacenamiento de registros duplicados en la base de datos.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;¿Cómo podemos evitar esto?&lt;/p&gt;  &lt;h4&gt;La solución: Post-Redirect-Get&lt;/h4&gt;  &lt;p&gt;El patrón PRG viene a indicarnos una forma de diseñar nuestras aplicaciones pensando en evitar los problemas descritos anteriormente, y, como veremos, es bastante simple. El procedimiento general a seguir sería:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Recibimos la petición &lt;u&gt;&lt;strong&gt;Post&lt;/strong&gt;&lt;/u&gt; con los datos que ha introducido el usuario en un formulario.&lt;/li&gt;    &lt;li&gt;Ejecutamos la lógica asociada a la recepción de dicho formulario, por ejemplo, grabar en la base de datos.&lt;/li&gt;    &lt;li&gt;Enviamos al cliente una respuesta con código HTTP 30x (&lt;u&gt;&lt;strong&gt;Redirect&lt;/strong&gt;&lt;/u&gt;), indicando al agente de usuario que debe solicitar otra página, en la mostraremos un mensaje informando de que el proceso se ha realizado con éxito.&lt;/li&gt;    &lt;li&gt;El navegador obtiene dicha página mediante una petición de tipo &lt;u&gt;&lt;strong&gt;Get&lt;/strong&gt;&lt;/u&gt;.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;En este punto, si el usuario decide &lt;strike&gt;(o el diablo que lleva dentro le ordena ;-))&lt;/strike&gt; refrescar la página, lo único que conseguirá será que su navegador vuelva a solicitar la página en la que le estamos informando de que el proceso ha sido satisfactorio. No se le muestra ningún cuadro de diálogo amenazante, ni se ejecuta la lógica de nuevo, ni hay ningún tipo de daños colaterales.&lt;/p&gt;  &lt;p&gt;El siguiente diagrama, basado en el de la imprescindible &lt;a title="PRG en Wikipedia" href="http://en.wikipedia.org/wiki/Post/Redirect/Get" target="_blank"&gt;Wikipedia&lt;/a&gt;, muestra gráficamente este proceso:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px auto 5px; display: block; float: none; border-top: 0px; border-right: 0px" title="Secuencia en el patrón PRG" border="0" alt="Secuencia en el patrón PRG" src="http://lh6.ggpht.com/_O9D62hXq-ng/SuiTfK1RApI/AAAAAAAABJA/656i4q5Ojkk/image%5B13%5D.png?imgmax=800" width="459" height="376" /&gt; &lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;¿Un poco de código? Sí, por favor&lt;/h4&gt;  &lt;h5&gt;ASP.NET WebForms&lt;/h5&gt;  &lt;p&gt;La abstracción sobre los protocolos montada por la tecnología Webforms hace más difícil reconocer los conceptos que estamos tratando, pero aún así es bastante sencillo aplicar el patrón.&lt;/p&gt;  &lt;p&gt;En los formularios web, los postbacks se realizan a través de métodos Http POST, por lo que la implementación de la lógica y la redirección podremos realizarlas en la implementación del evento de servidor correspondiente, por ejemplo, el de pulsación de un botón:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; btnAceptar_Click(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Page.IsValid)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// Lógica &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        Cliente cliente = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Cliente(txtNombre.Text, txtApellidos.Text);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        GestorDeClientes.Salvar(cliente);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;// Redirección&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        Response.Redirect(&lt;span style="color: #006080"&gt;&amp;quot;clientes.aspx&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;La página “clientes.aspx” podría ser ser el listado de clientes registrados en el sistema, por ejemplo.&lt;/p&gt;&lt;h5&gt;ASP.NET MVC&lt;/h5&gt;&lt;p&gt;En el framework MVC, por su cercanía a los protocolos, sí es fácil identificar los conceptos de petición y redirecciones. El siguiente código sería equivalente al anteriormente mostrado, pero enviando al usuario a la acción “Index”:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;[HandleError]&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ClientesController : Controller&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    ... &lt;span style="color: #008000"&gt;// Otras acciones&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [AcceptVerbs(HttpVerbs.Post)]&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Editar(Cliente cliente)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ModelState.IsValid)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            GestorDeClientes.Grabar(cliente);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; RedirectToAction(&lt;span style="color: #006080"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; View(cliente);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-6718055733302509787?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/6718055733302509787/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=6718055733302509787' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/6718055733302509787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/6718055733302509787'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/11/el-patron-post-redirect-get.html' title='El patrón Post-Redirect-Get'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-4425737153157361621</id><published>2009-10-29T23:41:00.000+01:00</published><updated>2009-10-29T23:41:00.249+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='noticias'/><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><category scheme='http://www.blogger.com/atom/ns#' term='redes sociales'/><title type='text'>Variable not found en Facebook</title><content type='html'>&lt;p&gt;Antes se solía decir que si no estabas en Internet, no existías; ahora que todo el mundo está en Internet, parece ser que si no estás en las redes sociales no existes. Cosas de la evolución, supongo ;-)&lt;/p&gt;  &lt;p&gt;Y aunque no soy muy amigo de este tipo de afirmaciones, por si acaso, en un auténtico alarde de socialización, he creado el sitio &lt;a title="Variable not found en Facebook" href="http://www.facebook.com/pages/Variable-not-found/94490426991" target="_blank"&gt;Variable not found en Facebook&lt;/a&gt;, que pongo a vuestra disposición para mantenernos en contacto de una forma algo más bidireccional de lo acostumbrado:&lt;/p&gt;  &lt;p&gt;&lt;a title="Variable not found en Facebook" href="http://www.facebook.com/pages/Variable-not-found/94490426991" target="_blank"&gt;&lt;img style="border-right-width: 0px; margin: 0px auto 5px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Variable not found en Facebook" border="0" alt="Variable not found en Facebook" src="http://lh6.ggpht.com/_O9D62hXq-ng/SughlU_8OBI/AAAAAAAABI0/vga2TwqHsBk/image%5B22%5D.png?imgmax=800" width="468" height="364" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Espero que nos veamos también por allí. Y sobre todo, que incrementemos el triste número de fans que tiene hasta el momento… :-DDD&lt;/p&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-4425737153157361621?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/4425737153157361621/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=4425737153157361621' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/4425737153157361621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/4425737153157361621'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/variable-not-found-en-facebook.html' title='Variable not found en Facebook'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-426781740341569584</id><published>2009-10-28T22:37:00.000+01:00</published><updated>2009-10-28T22:37:00.132+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='trucos'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>Modifica el portapapeles de tus visitantes con ZeroClipboard</title><content type='html'>&lt;p&gt;Si estás creando herramientas webs que generan código o texto para que tus visitantes lo copien y peguen en otras aplicaciones, &lt;a title="ZeroClipboard, en Google Code" href="http://code.google.com/p/zeroclipboard/"&gt;ZeroClipboard&lt;/a&gt; puede facilitar su utilización, al permitir introducir el contenido que deseemos en el portapapeles de los usuarios.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://lh5.ggpht.com/_O9D62hXq-ng/SuNY6gyr2wI/AAAAAAAABIk/O7ZMMRFfFLQ/image%5B3%5D.png?imgmax=800" width="296" height="137" /&gt; Hace tiempo ya comenté &lt;a title="Espía a tus visitantes con Ajax" href="http://www.variablenotfound.com/2007/06/espa-tus-visitantes-con-ajax.html"&gt;una forma de acceder transparentemente al portapapeles de los visitantes&lt;/a&gt; utilizando el objeto &lt;code&gt;window.clipboardData&lt;/code&gt;, pero esta posibilidad desapareció, al menos en su versión silenciosa, conforme los navegadores fueron tomándose más en serio los temas de seguridad. A día de hoy, si intentamos utilizar estas funciones desde Explorer, aparece un cuadro de diálogo de confirmación algo molesto, para alertar al usuario de que el script de una página está intentando acceder a dicha información.&lt;/p&gt;  &lt;p&gt;ZeroClipboard es una pequeña librería javascript que utiliza una película flash para acceder al portapapeles en modo “escritura”, es decir, para introducir en él un valor generado desde un script como respuesta a una acción del usuario como la pulsación de un botón o enlace. Podéis verlo en acción en esta &lt;a title="Demo de ZeroClipboard" href="http://bowser.macminicolo.net/~jhuckaby/zeroclipboard/"&gt;demo online&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;El siguiente código muestra cómo podemos utilizarlo. Creamos un &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; cuyo evento &lt;code&gt;onchange&lt;/code&gt; aprovechamos para ir almacenando el contenido que pasará al portapapeles cuando el usuario pulse el enlace (&lt;code&gt;btnCopiar&lt;/code&gt;) al que hemos vinculado este comportamiento:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:755b7cfc-f943-4815-bf45-6a19424768e3" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;overflow: auto;"&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;html &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;head&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;title&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Prueba de ZeroClipboard&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;title&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;script &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;type&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="text/javascript"&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; src&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="ZeroClipboard.js"&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;script&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;head&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;body&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;textarea &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;id&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="texto"&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; rows&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="10"&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; cols&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="10"&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; &lt;br /&gt;              onchange&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="clip.setText(this.value);"&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;textarea&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;br &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;a &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;id&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="btnCopiar"&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; href&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="#"&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Copiar&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;a&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;body&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;script &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;type&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;="text/javascript"&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;&lt;br /&gt;    clip &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;=&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; ZeroClipboard.Client();&lt;br /&gt;    clip.glue(&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;btnCopiar&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;script&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;html&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;&lt;p&gt;Si lo probáis, podréis ver que en ningún momento se alerta al usuario de que su portapapeles va a ser modificado, quedando muy limpio y profesional. :-) &lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-426781740341569584?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/426781740341569584/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=426781740341569584' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/426781740341569584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/426781740341569584'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/modifica-el-portapapeles-de-tus.html' title='Modifica el portapapeles de tus visitantes con ZeroClipboard'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-1612222488253071564</id><published>2009-10-26T23:49:00.000+01:00</published><updated>2009-10-26T23:49:00.336+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jqGrid'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='componentes'/><title type='text'>jqGrid: Grids espectaculares para ASP.NET MVC, paso a paso</title><content type='html'>&lt;p&gt;&lt;a title="Scott Hanselman&amp;#39;s Computer Zen" href="http://www.hanselman.com/blog/ASPNETMVCWebFormsUnplugged.aspx"&gt;&lt;/a&gt;&lt;a title="Scott Hanselman&amp;#39;s Computer Zen" href="http://www.hanselman.com/blog/ASPNETMVCWebFormsUnplugged.aspx" hreflang="en"&gt;Dicen las malas lenguas&lt;/a&gt; ;-) que durante una reunión del equipo de diseño de ASP.NET MVC alguien dijo: “necesitaremos un control tipo Repeater”, refiriéndose a algún tipo de mecanismo para mostrar datos tabulados de forma sencilla. Y la respuesta del jefe técnico fue, “ya lo tenemos: se llama bucle foreach”. &lt;/p&gt;  &lt;p&gt;Anécdotas aparte, es cierto que en ASP.NET MVC 1.0 no existe otro mecanismo que el bucle de toda la vida para mostrar datos en tablas, la típica rejilla con información sobre elementos de una colección tan habitual en nuestras aplicaciones. La máxima ayuda que tenemos “de serie” es el andamiaje generado por Visual Studio a la hora de generar una vista sobre una enumeración de elementos, que es válida únicamente en escenarios muy sencillos.&lt;/p&gt;  &lt;p&gt;Y aquí es donde entra &lt;a title="jQuery Grid Plugin" href="http://www.trirand.com/blog/" hreflang="en"&gt;jQuery Grid Plugin&lt;/a&gt;&lt;a title="jQuery Grid Plugin" href="http://www.trirand.com/blog/"&gt;&lt;/a&gt; (&lt;strong&gt;jqGrid&lt;/strong&gt; para los amigos), un plugin para jQuery que se integra perfectamente con ASP.NET MVC y que permite simplificar enormemente el desarrollo&amp;#160; de vistas de tipo grid ofreciendo al mismo tiempo unas funcionalidades espectaculares: paginación, carga de datos de forma asíncrona vía Ajax, ordenación y redimensionado de columnas, edición de celdas, interfaz multi-idioma basado en temas, y &lt;a title="Características de jqGrid" href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:features" hreflang="en"&gt;un larguísimo etcétera&lt;/a&gt;&lt;a title="Características de jqGrid" href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:features"&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;En este post vamos a implementar un grid simple de consulta de datos utilizando jqGrid 3.5 y ASP.NET MVC 1.0, paso a paso. Además, al final del post encontraréis un enlace para descargar el proyecto de demostración para Visual Studio 2008 Express.&lt;/p&gt;  &lt;h3&gt;1. Descargamos jqGrid&lt;/h3&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Descarga de jqGrid" border="0" alt="Descarga de jqGrid" align="right" src="http://lh4.ggpht.com/_O9D62hXq-ng/SuL1LRNgRXI/AAAAAAAABIY/n3b__m6favY/image5.png?imgmax=800" width="239" height="210" /&gt;Lo primero, como siempre, es descargar los componentes necesarios. Para hacernos con jqGrid, es necesario visitar la página de &lt;a title="Descargar jqGrid" href="http://www.trirand.com/blog/?page_id=6"&gt;descargas&lt;/a&gt; del proyecto, en la que podemos encontrar un selector que nos permitirá elegir los módulos asociados a las funcionalidades que vayamos a utilizar.&lt;/p&gt;  &lt;p&gt;En nuestro caso, dado que vamos a implementar un escenario muy simple, seleccionaremos únicamente el módulo “Grid base” y pulsamos el botón &lt;em&gt;download&lt;/em&gt; situado en el pie de la tabla.&lt;/p&gt;  &lt;p&gt;La descarga es un archivo .zip bastante ligerito cuyo contenido utilizamos así:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;code&gt;jquery.jqGrid.min.js&lt;/code&gt;, que encontraréis en la carpeta “js” del archivo descargado, lo copiamos a la carpeta “scripts” del proyecto ASP.NET MVC. &lt;/li&gt;    &lt;li&gt;&lt;code&gt;grid.locale-sp.js&lt;/code&gt; , el archivo de localización al español que encontraremos en la carpeta “js/i18n” del .zip, lo copiamos también a la carpeta “scripts” del proyecto. &lt;/li&gt;    &lt;li&gt;&lt;code&gt;ui.jqgrid.css&lt;/code&gt; , disponible en la carpeta “css” del archivo comprimido, lo pasamos a la carpeta “content” del proyecto. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Archivos del proyecto" border="0" alt="Archivos del proyecto" align="right" src="http://lh5.ggpht.com/_O9D62hXq-ng/SuL1L2jbhhI/AAAAAAAABIc/G4l2-ro3UMU/image13.png?imgmax=800" width="260" height="301" /&gt; 2. Descargamos un tema visual&lt;/h3&gt;  &lt;p&gt;jqGrid utiliza los temas visuales de &lt;a title="jQuery UI" href="http://www.jqueryui.com/"&gt;jQuery UI&lt;/a&gt; para componer el interfaz, por lo que es necesario &lt;a title="Temas jQuery UI" href="http://www.jqueryui.com/themeroller/"&gt;descargar&lt;/a&gt; alguno de los disponibles o bien crear uno personalizado con la herramienta on-line disponible en su página. Para nuestro ejemplo, vamos a utilizar el tema “&lt;a title="Tema Cupertino" href="http://www.jqueryui.com/download/?themeParams=%3FffDefault%3DLucida+Grande%252C+Lucida+Sans%252C+Arial%252C+sans-serif%26fwDefault%3Dbold%26fsDefault%3D1.1em%26cornerRadius%3D6px%26bgColorHeader%3Ddeedf7%26bgTextureHeader%3D03_highlight_soft.png%26bgImgOpacityHeader%3D100%26borderColorHeader%3Daed0ea%26fcHeader%3D222222%26iconColorHeader%3D72a7cf%26bgColorContent%3Df2f5f7%26bgTextureContent%3D04_highlight_hard.png%26bgImgOpacityContent%3D100%26borderColorContent%3Ddddddd%26fcContent%3D362b36%26iconColorContent%3D72a7cf%26bgColorDefault%3Dd7ebf9%26bgTextureDefault%3D02_glass.png%26bgImgOpacityDefault%3D80%26borderColorDefault%3Daed0ea%26fcDefault%3D2779aa%26iconColorDefault%3D3d80b3%26bgColorHover%3De4f1fb%26bgTextureHover%3D02_glass.png%26bgImgOpacityHover%3D100%26borderColorHover%3D74b2e2%26fcHover%3D0070a3%26iconColorHover%3D2694e8%26bgColorActive%3D3baae3%26bgTextureActive%3D02_glass.png%26bgImgOpacityActive%3D50%26borderColorActive%3D2694e8%26fcActive%3Dffffff%26iconColorActive%3Dffffff%26bgColorHighlight%3Dffef8f%26bgTextureHighlight%3D03_highlight_soft.png%26bgImgOpacityHighlight%3D25%26borderColorHighlight%3Df9dd34%26fcHighlight%3D363636%26iconColorHighlight%3D2e83ff%26bgColorError%3Dcd0a0a%26bgTextureError%3D01_flat.png%26bgImgOpacityError%3D15%26borderColorError%3Dcd0a0a%26fcError%3Dffffff%26iconColorError%3Dffffff%26bgColorOverlay%3Deeeeee%26bgTextureOverlay%3D08_diagonals_thick.png%26bgImgOpacityOverlay%3D90%26opacityOverlay%3D80%26bgColorShadow%3D000000%26bgTextureShadow%3D04_highlight_hard.png%26bgImgOpacityShadow%3D70%26opacityShadow%3D30%26thicknessShadow%3D7px%26offsetTopShadow%3D-7px%26offsetLeftShadow%3D-7px%26cornerRadiusShadow%3D8px"&gt;Cupertino&lt;/a&gt;”.&lt;/p&gt;  &lt;p&gt;Como en el caso anterior, &lt;a title="Descargar jQuery UI" href="http://www.trirand.com/blog/?page_id=6"&gt;seleccionamos los componentes&lt;/a&gt; a obtener (en principio, basta con UI Core a no ser que vayáis a utilizar esta librería para otras cosas), el tema, y pulsamos el botón &lt;em&gt;download&lt;/em&gt;. Descargaremos un archivo .zip en cuyo&amp;#160; interior encontramos, dentro de la carpeta “css”, una subcarpeta con el nombre del tema elegido y que copiamos a la carpeta “content” del proyecto MVC.&lt;/p&gt;  &lt;p&gt;La imagen anterior muestra la distribución de los archivos descritos hasta el momento en las distintas carpetas en las que hay que colocarlos.&lt;/p&gt;  &lt;h3&gt;3. Incluimos los componentes en el proyecto ASP.NET MVC&lt;/h3&gt;  &lt;p&gt;Tras crear el proyecto ASP.NET MVC, vamos a incluirle ahora las referencias a librerías y archivos necesarios para poder utilizar jqGrid. &lt;/p&gt;  &lt;p&gt;Básicamente, tendremos que incluir en las páginas donde vayamos a utilizarlo referencias a jQuery, jqGrid, el archivo de localización, la hoja de estilos utilizada por jqGrid, y el tema que estemos empleando. Lo más fácil es hacerlo a nivel de página maestra, por ejemplo así:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;head runat=&lt;span style="color: #006080"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;title&amp;gt;&amp;lt;asp:ContentPlaceHolder ID=&lt;span style="color: #006080"&gt;&amp;quot;TitleContent&amp;quot;&lt;/span&gt; runat=&lt;span style="color: #006080"&gt;&amp;quot;server&amp;quot;&lt;/span&gt; /&amp;gt;&amp;lt;/title&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;link href=&lt;span style="color: #006080"&gt;&amp;quot;../../Content/Site.css&amp;quot;&lt;/span&gt; rel=&lt;span style="color: #006080"&gt;&amp;quot;stylesheet&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/css&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;link href=&lt;span style="color: #006080"&gt;&amp;quot;../../Content/ui.jqgrid.css&amp;quot;&lt;/span&gt; rel=&lt;span style="color: #006080"&gt;&amp;quot;stylesheet&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/css&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;link href=&lt;span style="color: #006080"&gt;&amp;quot;../../Content/cupertino/jquery-ui-1.7.2.custom.css&amp;quot;&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;          rel=&lt;span style="color: #006080"&gt;&amp;quot;stylesheet&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/css&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;../../Scripts/jquery-1.3.2.min.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;../../Scripts/grid.locale-sp.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;../../Scripts/jquery.jqGrid.min.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;/head&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Es importante incluir todos los archivos y en el orden correcto, de lo contrario el plugin no funcionará correctamente.&lt;/p&gt;&lt;h3&gt;4. El modelo&lt;/h3&gt;&lt;p&gt;En lugar de utilizar una base de datos, vamos a crear una simulación en memoria de un almacén de datos personales basado en la siguiente entidad:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Amigo&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Id { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Nombre { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Apellidos { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; DateTime FechaDeNacimiento { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Email { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;La lógica de negocio está implementada en la clase &lt;code&gt;GestorDeAmigos&lt;/code&gt;, que incluye, además del constructor que carga los datos iniciales en el almacén (una colección de tipo &lt;code&gt;List&amp;lt;Amigo&amp;gt;&lt;/code&gt; , los siguientes métodos:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IEnumerable&amp;lt;Amigo&amp;gt; ObtenerAmigos(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; pagina, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; elementosPorPagina, &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                                        Func&amp;lt;Amigo, IComparable&amp;gt; orden, &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                                        Ordenacion ordenacion)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    IEnumerable&amp;lt;Amigo&amp;gt; datos;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ordenacion==Ordenacion.Ascendente)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        datos = datosAmigos.OrderBy(orden);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        datos = datosAmigos.OrderByDescending(orden);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; datos.Skip((pagina - 1) * elementosPorPagina).Take(elementosPorPagina);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; ContarAmigos()&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; datosAmigos.Count;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Del código anterior, sólo comentar los parámetros del método ObtenerAmigos:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;&lt;code&gt;pagina&lt;/code&gt; y &lt;code&gt;elementosPorPagina&lt;/code&gt;, indican, respectivamente el número de página de datos a mostrar y el número de registros máximo a mostrar en cada una de ellas. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;orden &lt;/code&gt;es una &lt;a title="Desmitificando las expresiones lambda" href="http://www.variablenotfound.com/2009/03/c-desmitificando-las-expresiones-lambda.html"&gt;lambda&lt;/a&gt; que retorna la expresión por la cual ordenaremos los datos. Si estuviéramos utilizando consultas SQL directas o LINQ to SQL podríamos usar otros enfoques, como la construcción de queries dinámicas o &lt;a title="Dynamic LINQ(Parte 1 Usando la librería de LINQ Dynamic) « Thinking in .NET" href="http://thinkingindotnet.wordpress.com/2008/01/08/dynamic-linqparte-1-usando-la-libreria-de-linq-dynamic/"&gt;Dynamic LINQ&lt;/a&gt;. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;ordenacion&lt;/code&gt; indica, usando una enumeración, si el orden es ascendente o descendente. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Así, a continuación puede verse un ejemplo de lo simple que quedaría una llamada a este método, flexible pero con tipado fuerte:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var amigos = gestorDeAmigos.ObtenerAmigos(&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   1,                       &lt;span style="color: #008000"&gt;// Página actual&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   25,                      &lt;span style="color: #008000"&gt;// Registros por página&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   amigo=&amp;gt;amigo.Apellidos,  &lt;span style="color: #008000"&gt;// Expresión de ordenación&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   Ordenacion.Ascendente    &lt;span style="color: #008000"&gt;// Orden&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             );&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;h3&gt;5. El controlador&lt;/h3&gt;&lt;p&gt;Una de las principales ventajas que ofrece jqGrid es que la carga de los datos la realiza mediante peticiones Ajax. En la práctica, esto significa que irá lanzando llamadas a una acción de nuestro controlador para solicitarle la información conforme vaya necesitando datos, por ejemplo, durante la carga inicial de la página o cuando el usuario utiliza las herramientas de paginación, enviándole los siguientes parámetros:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;&lt;code&gt;sidx&lt;/code&gt;, el índice o nombre del campo de ordenación actual. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;sord&lt;/code&gt;, “asc” o “desc”, indicando si el orden es ascendente o descendente. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;page&lt;/code&gt;, el número de página actual. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;rows&lt;/code&gt;, número de elementos a obtener para completar la página. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;El retorno de este método de acción debe ser un objeto serializado en JSON (aunque también permite XML) y ha de ajustarse a un formato especificado en la documentación, que es el que jqGrid espera recibir, algo como:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{ &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  total: &lt;span style="color: #006080"&gt;&amp;quot;xxx&amp;quot;&lt;/span&gt;, &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  page: &lt;span style="color: #006080"&gt;&amp;quot;yyy&amp;quot;&lt;/span&gt;, &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  records: &lt;span style="color: #006080"&gt;&amp;quot;zzz&amp;quot;&lt;/span&gt;,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  rows : [&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {id:&lt;span style="color: #006080"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;, cell:[&lt;span style="color: #006080"&gt;&amp;quot;cell11&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;cell12&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;cell13&amp;quot;&lt;/span&gt;]},&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {id:&lt;span style="color: #006080"&gt;&amp;quot;2&amp;quot;&lt;/span&gt;, cell:[&lt;span style="color: #006080"&gt;&amp;quot;cell21&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;cell22&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;cell23&amp;quot;&lt;/span&gt;]},&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      ...&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  ]&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;El método de obtención de datos,&amp;#160; nuestra acción, seguirá normalmente el patrón recogido en el código mostrado a continuación. Si os fijáis, lo único que estamos haciendo es reproducir fielmente esta estructura anterior en un objeto anónimo, de forma que&amp;#160; al transformarlo en JSON (gracias al retorno de tipo &lt;code&gt;JsonResult&lt;/code&gt;) se genere justo lo que necesitamos:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult ObtenerDatosGrid(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sidx, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sord, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; page, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; rows)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; datos = [...]          &lt;span style="color: #008000"&gt;// Obtener datos del modelo&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; totalRegistros = [...] &lt;span style="color: #008000"&gt;// Contar todos los registros&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; totalPages = (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;)Math.Ceiling((&lt;span style="color: #0000ff"&gt;decimal&lt;/span&gt;)totalRegistros / (&lt;span style="color: #0000ff"&gt;decimal&lt;/span&gt;)rows);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; data = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        total = totalPages,        &lt;span style="color: #008000"&gt;// Total de páginas&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        page = page,               &lt;span style="color: #008000"&gt;// Página actual&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        records = totalRegistros,  &lt;span style="color: #008000"&gt;// Total de registros (obtenido del modelo)&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        rows = from a &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; datos     &lt;span style="color: #008000"&gt;// Datos de filas&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               select &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   id = a.Id,                &lt;span style="color: #008000"&gt;// ID único de la fila&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   cell = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] {     &lt;span style="color: #008000"&gt;// Array de celdas de la fila&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                       a.Apellidos,                             &lt;span style="color: #008000"&gt;// Primera columna,            &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                       a.Nombre,                                &lt;span style="color: #008000"&gt;// Segunda columna,&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                       a.FechaDeNacimiento.ToShortDateString(), &lt;span style="color: #008000"&gt;// Tercera columna,&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                       a.Email                                  &lt;span style="color: #008000"&gt;// Cuarta columna  &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    };&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Json(data);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Nuestro ejemplo se ajusta totalmente al patrón anterior, aunque incluiremos código extra para tener en cuenta las ordenaciones indicadas por los parámetros &lt;code&gt;sidx &lt;/code&gt;y &lt;code&gt;sord&lt;/code&gt; en la invocación al modelo. Observad cómo construimos las expresiones de ordenación:&lt;/p&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult ObtenerDatosGrid(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sidx, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sord, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; page, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; rows)&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// Establecemos la función de ordenación dependiendo del valor del &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// parámetro &amp;quot;sidx&amp;quot;, que es el campo de orden actual&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Func&amp;lt;Amigo, IComparable&amp;gt; funcOrden =&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        sidx == &lt;span style="color: #006080"&gt;&amp;quot;Apellidos&amp;quot;&lt;/span&gt; ? a =&amp;gt; a.Apellidos :&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        sidx == &lt;span style="color: #006080"&gt;&amp;quot;FechaDeNacimiento&amp;quot;&lt;/span&gt; ? a =&amp;gt; a.FechaDeNacimiento :&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        sidx == &lt;span style="color: #006080"&gt;&amp;quot;Email&amp;quot;&lt;/span&gt; ? a =&amp;gt; a.Email :&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        (Func&amp;lt;Amigo, IComparable&amp;gt;)(a =&amp;gt; a.Id);&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// Establecemos si se trata de orden ascendente o descendente, en&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// función del parámetro &amp;quot;sord&amp;quot;, que puede valer &amp;quot;asc&amp;quot; o &amp;quot;desc&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Ordenacion ordenacion = sord == &lt;span style="color: #006080"&gt;&amp;quot;asc&amp;quot;&lt;/span&gt; ? Ordenacion.Ascendente : Ordenacion.Descendente;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// Usamos el modelo para obtener los datos&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; datos = gestorDeAmigos.ObtenerAmigos(page, rows, funcOrden, ordenacion);&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; totalRegistros = gestorDeAmigos.ContarAmigos();&lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    ... &lt;/pre&gt;&lt;!--CRLF--&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;h3&gt;6. La vista&lt;/h3&gt;&lt;p&gt;En la vista debemos crear un elemento contenedor, concretamente una tabla XHTML con un identificador único que después usaremos para indicarle al plugin dónde tiene que actuar &lt;em&gt;su magia&lt;/em&gt;. Si además, como bastante habitual, pensamos incluir herramientas de paginación, tendremos que incluir también un contenedor para la misma:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;table&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;list&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;table&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;pager&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;El siguiente paso es inicializar jqGrid cuando se termine de cargar la página, para lo que crearemos un código javascript como el mostrado a continuación, en el que se invoca la función de activación del plugin sobre la tabla cuyo ID se indica en el selector (“&lt;code&gt;#list&lt;/code&gt;“), y especificando el comportamiento deseado en los parámetros que le siguen:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;script type=&amp;quot;text/javascript&amp;quot;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    jQuery(document).ready(function() {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        jQuery(&amp;quot;#list&amp;quot;).jqGrid({&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            url: '&lt;span style="background-color: #ffff00"&gt;&amp;lt;%&lt;/span&gt;= Url.Action(&lt;span style="color: #006080"&gt;&amp;quot;ObtenerDatosGrid&amp;quot;&lt;/span&gt;) &lt;!--CRLF--&gt;&lt;span style="background-color: #ffff00"&gt;%&amp;gt;&lt;/span&gt;',&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            datatype: 'json',&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            mtype: 'GET',&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            colNames: ['Apellidos', 'Nombre', 'Fecha Nac.', 'Email'],&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            colModel: [&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              { index: 'Apellidos', width: 150, align: 'left' },&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              { index: 'Nombre', width: 150, align: 'left', sortable: false },&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              { index: 'FechaDeNacimiento', width: 80, align: 'center' },&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;              { index: &amp;quot;Email&amp;quot;, width: 120, align: 'left'}],&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            pager: jQuery('#pager'),&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            rowNum: 20,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            rowList: [20, 50, 100],&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            sortname: 'Apellidos',&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            sortorder: 'asc',&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            viewrecords: true,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            imgpath: '/content/cupertino/images',&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            caption: 'Agenda personal',&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            height: 400,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            width: 900,&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            onSelectRow: function(id) {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                alert(&amp;quot;Pulsado Id: &amp;quot; + id);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        });&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }); &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Revisamos rápidamente el significado de los distintos parámetros:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;&lt;code&gt;url&lt;/code&gt;, la dirección de la acción que suministrará los datos. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;datatype&lt;/code&gt;, que indica el formato de intercambio de datos. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;mtype&lt;/code&gt; , el verbo HTTP (get o post) que se utilizará para las peticiones. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;&lt;code&gt;&lt;code&gt;colnames&lt;/code&gt;&lt;/code&gt;&lt;/code&gt;, un array con los títulos de las columnas. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;colmodel&lt;/code&gt;, un array en el que cada elemento es un objeto que define     &lt;ul&gt;      &lt;li&gt;&lt;code&gt;index&lt;/code&gt;: el nombre del campo que recibiremos en el método de acción indicando la ordenación actual. &lt;/li&gt;      &lt;li&gt;&lt;code&gt;width&lt;/code&gt;: el ancho, en píxeles. &lt;/li&gt;      &lt;li&gt;&lt;code&gt;align&lt;/code&gt;: alineación de la columna. &lt;/li&gt;      &lt;li&gt;&lt;code&gt;sortable&lt;/code&gt;: si la columna se puede utilizar como criterio de ordenación. &lt;/li&gt;    &lt;/ul&gt;  &lt;/li&gt;  &lt;li&gt;&lt;code&gt;pager&lt;/code&gt;, el elemento sobre el que se compondrá la herramienta de paginación. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;rownum&lt;/code&gt;, número de elementos por página. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;rowlist&lt;/code&gt;, elementos por página mostrados en un desplegable para que el usuario lo ajuste. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;sortname&lt;/code&gt;, el campo de ordenación por defecto. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;sortorder&lt;/code&gt;, si la ordenación por defecto es ascendente o descendente. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;viewrecords&lt;/code&gt;, si se muestra el total de registros en la herramienta de paginación. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;imgpath&lt;/code&gt; , ruta hacia la carpeta de imágenes del tema elegido. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;caption&lt;/code&gt;, el título del grid. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;height&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, alto y ancho del grid, en píxeles. &lt;/li&gt;  &lt;li&gt;&lt;code&gt;onSelectRow&lt;/code&gt;, función anónima ejecutada cuando el usuario selecciona una fila. Recibe como parámetro el identificador único del registro. &lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Y… ¡Voilá!&lt;/h3&gt;&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Demo de jqGrid en acción" border="0" alt="Demo de jqGrid en acción" align="right" src="http://lh3.ggpht.com/_O9D62hXq-ng/SuL1NzcdCYI/AAAAAAAABIg/t9xDHnhqDO8/image%5B9%5D.png?imgmax=800" width="406" height="350" /&gt;¡Hasta aquí hemos llegado! Hemos visto cómo utilizar el magnífico jqGrid en un escenario simple, paso a paso, comenzando por la descarga de los componentes, preparando el proyecto para poder utilizarlos y, finalmente, implementando el modelo, el controlador, y la vista.&lt;/p&gt;&lt;p&gt;Pero jqGrid no es sólo eso, ni mucho menos. No hemos visto más que la punta del iceberg: el plugin permite realizar búsquedas, edición, anidación de grids, árboles, escenarios maestro-detalle… en fin, una maravilla.&lt;/p&gt;&lt;p&gt;jqGrid se distribuye bajo licencia dual GPL y MIT, y puede ser utilizado tanto en proyectos comerciales como libres. Dispone de una &lt;a title="Documentación jqGrid" href="http://www.secondpersonplural.ca/jqgriddocs/index.htm" hreflang="en"&gt;documentación&lt;/a&gt;&lt;a title="Documentación jqGrid" href="http://www.secondpersonplural.ca/jqgriddocs/index.htm"&gt;&lt;/a&gt;&lt;a title="Documentación de jqGrid" href="http://www.trirand.com/jqgridwiki/"&gt;&lt;/a&gt; bastante razonable, y &lt;a title="Ejemplos de jqGrid" href="http://trirand.com/jqgrid/jqgrid.html"&gt;muchos ejemplos&lt;/a&gt; para que podamos apreciar sus virtudes.&lt;/p&gt;&lt;p&gt;Descargar proyecto de demostración:&lt;/p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="http://cid-c3a43a99b617d787.skydrive.live.com/embedicon.aspx/P%c3%bablico/variablenotfound.com/ASP.NET%20MVC/ASP.NET%20MVC%201.0/Demo%20jqGrid/jqGridMVC.zip" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-1612222488253071564?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/1612222488253071564/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=1612222488253071564' title='12 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1612222488253071564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1612222488253071564'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/jqgrid-grids-espectaculares-para-aspnet.html' title='jqGrid: Grids espectaculares para ASP.NET MVC, paso a paso'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-2067150355761666300</id><published>2009-10-20T01:23:00.001+02:00</published><updated>2009-10-20T01:23:00.326+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='frikadas'/><category scheme='http://www.blogger.com/atom/ns#' term='cultura'/><title type='text'>Ilities</title><content type='html'>&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="El listo" border="0" alt="El listo" align="right" src="http://lh5.ggpht.com/_O9D62hXq-ng/SsD9ZBa0-FI/AAAAAAAABH0/BpLz3jB1h98/image%5B8%5D.png?imgmax=800" width="117" height="159" /&gt; Los “ilities”, cuya traducción a nuestro idioma podría ser algo así como “ilidades”, son atributos que definen aspectos no funcionales y normalmente asociados con requisitos técnicos y cualidades de un sistema o componente software. El nombre viene del sufijo &lt;em&gt;–ilidad, &lt;/em&gt;que, como podréis ver a continuación, es común a la práctica totalidad de ellos.&lt;/p&gt;  &lt;p&gt;He encontrado en la &lt;a title="List of System Quality Attributes" href="http://en.wikipedia.org/wiki/List_of_system_quality_attributes"&gt;Wikipedia&lt;/a&gt; una interesante (aunque no exhaustiva) relación ilidades, que podemos utilizar a la hora de intentar transmitir las características de un sistema… o simplemente para aparentar ser auténticos expertos en una reunión de trabajo ;-)&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Accesibilidad&lt;/strong&gt;, es decir, el hecho ser accesible a muchas personas, con independencia de sus características, dispositivos utilizados, etc. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Reportabilidad&lt;/strong&gt;, capacidad para monitorizar y registrar las acciones del usuario. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Exactitud&lt;/strong&gt;, grado de distancia desde los resultados ofrecidos por un sistema a los valores entendidos como reales. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Adaptabilidad&lt;/strong&gt;, facilidad que presenta un software para ser adaptado a necesidades concretas. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Administrabilidad&lt;/strong&gt;, indica la capacidad de un sistema o componente para ser administrado y gestionado. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Asequibilidad&lt;/strong&gt;, que indica que, atendiendo a su coste, el sistema puede ser adquirido o conseguido por los clientes. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Auditabilidad&lt;/strong&gt;, transparencia frente a sistemas de auditoría. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Disponibilidad&lt;/strong&gt;, grado en el que un sistema está disponible, operativo y funcional. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Credibilidad&lt;/strong&gt;, que es considerado subjetiva y objetivamente como una fuente de información fiable. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Conformidad con estándares&lt;/strong&gt;, grado de cercanía a las prácticas o técnicas aceptadas como estándares. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Compatibilidad&lt;/strong&gt;, que funciona en un escenario determinado, o permite sustituir otros sistemas equivalentes. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Componibilidad&lt;/strong&gt;, capacidad para combinar el software con otros elementos para componer sistemas no previstos inicialmente. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Configurabilidad&lt;/strong&gt;, esto es, que dispone de mecanismos que permiten configurar algunos aspectos de su comportamiento. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Corrección&lt;/strong&gt;, que indica que el software actúa conforme a sus especificaciones. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Personalizabilidad&lt;/strong&gt;, capacidad de un sistema para ser personalizado a las preferencias de sus usuarios. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Degradabilidad&lt;/strong&gt;, capacidad para mantener las funcionalidades básicas en condiciones adversas. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Demostrabilidad&lt;/strong&gt;, aplicable a aquellos sistemas cuyo funcionamiento puede ser demostrado. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Dependabilidad&lt;/strong&gt;, que define la probabilidad de que el sistema complete su misión, dado que estaba disponible en el comienzo de la misma. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Desplegabilidad&lt;/strong&gt;, capacidad de un software para ser desplegado en un escenario. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Distribuibilidad&lt;/strong&gt;, capacidad o facilidad de un componente o sistema para ser distribuido.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Durabilidad&lt;/strong&gt;, mantenimiento de las funciones con el paso del tiempo.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Efectividad&lt;/strong&gt;, o capacidad para lograr el efecto deseado.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Eficiencia&lt;/strong&gt;, capacidad para lograr el efecto deseado con el menor consumo posible de recursos.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Evolucionabilidad&lt;/strong&gt;, grado de facilidad con la que es posible hacer evolucionar un sistema para adaptarse a nuevas condiciones.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Extensibilidad&lt;/strong&gt;, capacidad de un software para ser ampliado con nuevas funciones sin modificar su estructura básica.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Fidelidad&lt;/strong&gt;, que ofrece precisión y confianza en la representación de la realidad.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Flexibilidad&lt;/strong&gt;, que puede adaptarse con facilidad a cambios en el entorno.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Instalabilidad&lt;/strong&gt;, facilidad para ser instalado en un entorno&amp;#160; determinado.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Integridad&lt;/strong&gt;, capacidad para evitar y sobreponerse a errores en la información que maneja.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Intercambiabilidad&lt;/strong&gt;, que indica que un componente puede ser sustituido por otro sin modificar aquellos que lo utilizan.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Interoperabilidad&lt;/strong&gt;, capacidad que tiene un sistema para intercambiar información con otro.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Aprendibilidad&lt;/strong&gt;, es decir, la capacidad que presenta un software para enseñar su propio manejo al usuario.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Mantenibilidad&lt;/strong&gt;, o facilidad con la que se puede corregir, modificar o ampliar un software.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Gestionabilidad&lt;/strong&gt;, facilidad para gestionar la complejidad de un sistema.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Movilidad&lt;/strong&gt;, posibilidad que tiene un sistema de funcionar en distintas ubicaciones geográficas.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Modularidad&lt;/strong&gt;, grado en el que un software está internamente dividido en bloques independientes.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Nomadicidad&lt;/strong&gt;, capacidad de un sistema para adaptarse de forma transparente a una situación de desconexión por cambio de ubicación-&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Operabilidad&lt;/strong&gt;, capacidad de un software para funcionar y cumplir su misión.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Portabilidad&lt;/strong&gt;, la facilidad con la que un software puede ser transferido a otro entorno software o hardware.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Precisión&lt;/strong&gt;, nivel de detalle con el que un sistema es capaz de manejar información.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Predictibilidad&lt;/strong&gt;, grado de certeza del comportamiento del sistema ante un escenario determinado.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Recuperabilidad&lt;/strong&gt;, capacidad de un sistema de restablecer un nivel apropiado de servicio y recuperar sus datos en caso de producirse fallos.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Fiabilidad, &lt;/strong&gt;es la habilidad de un software para realizar sus funciones de forma correcta bajo unas condiciones determinadas.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Repetibilidad&lt;/strong&gt;, es la capacidad de generar el mismo resultado si no cambian las condiciones.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Reproducibilidad&lt;/strong&gt;, es el grado de precisión que se obtiene al intentar reproducir un comportamiento del sistema.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Responsividad, &lt;/strong&gt;velocidad con la que un sistema realiza una tarea, por ejemplo responder a la entrada del usuario.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Reusabilidad&lt;/strong&gt;, facilidad con la que un componente o sistema puede ser reutilizado para añadir funcionalidades o características en un nuevo sistema.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Robustez&lt;/strong&gt;, capacidad para continuar la operación aún en el caso de producirse errores inesperados.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Seguridad&lt;/strong&gt;, capacidad de un software para conseguir niveles aceptables de daños a personas, negocios, software, propiedades o entorno.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Escalabilidad&lt;/strong&gt;, facilidad con la que un sistema puede ser adaptado para satisfacer necesidades mayores de carga de trabajo.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Uniformidad&lt;/strong&gt;, grado de presentación como una estructura consistente, aunque el sistema incluya diversas tecnologías.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Soportabilidad&lt;/strong&gt;, que hace referencia a la habilidad del soporte técnico para dar soporte a los productos.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Asegurabilidad&lt;/strong&gt;, capacidad para asegurar distintos niveles de un sistema.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Simplicidad&lt;/strong&gt;, o ausencia de complicaciones y dificultades.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Estabilidad&lt;/strong&gt;, capacidad de un software para funcionar períodos del tiempo sin parar o funcionar incorrectamente.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Comprobabilidad&lt;/strong&gt;, el grado en el que un componente soporta la realización de pruebas para validar su corrección.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Oportunidad&lt;/strong&gt;, es decir, el hecho de estar disponible en el momento en el que debe estarlo.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Ubicuidad&lt;/strong&gt;, capacidad de un software para estar presente en todas partes, en cualquier momento.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Comprensibilidad&lt;/strong&gt;, facilidad con la que un software puede ser comprendido a los distintos niveles.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Usabilidad&lt;/strong&gt;, facilidad con la que un usuario puede utilizar un sistema software para conseguir un objetivo.&lt;strong&gt;&amp;#160;&lt;/strong&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Los términos originales estaban en inglés y algunos no eran fácilmente traducibles, así que en más de una ocasión he tenido que echar mano de la creatividad y patear a la RAE y todos sus integrantes ;-D&lt;/p&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-2067150355761666300?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/2067150355761666300/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=2067150355761666300' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2067150355761666300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2067150355761666300'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/ilities.html' title='Ilities'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-1511526303900557184</id><published>2009-10-14T13:00:00.001+02:00</published><updated>2009-10-15T09:27:53.510+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='servicios on-line'/><title type='text'>En la onda, con Google Wave</title><content type='html'>&lt;p&gt;No recuerdo cuándo exactamente, debió ser cuando estuve comentando la presentación de esa misteriosa criatura llamada &lt;a title="Sintoniza la onda de Google" href="http://www.variablenotfound.com/2009/05/sintoniza-la-onda-de-google.html"&gt;Google Wave&lt;/a&gt;, pero al parecer solicité una invitación para probar el producto, y hoy me ha llegado.&lt;/p&gt;  &lt;p&gt;Tras seguir el enlace recibido por email, he instalado &lt;a title="Chrome Frame" href="http://code.google.com/intl/es/chrome/chromeframe/"&gt;Chrome Frame&lt;/a&gt;, el complemento para Internet Explorer que permite incrustar el navegador Chrome, y ya se puede decir que estoy en la onda ;-)&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px auto 5px; display: block; float: none; border-top: 0px; border-right: 0px" title="Google Wave en acción" border="0" alt="Google Wave en acción" src="http://lh3.ggpht.com/_O9D62hXq-ng/StWGiORNV4I/AAAAAAAABIU/yQ_6gRwDWho/image%5B9%5D.png?imgmax=800" width="539" height="425" /&gt; &lt;/p&gt;  &lt;p&gt;A ver si un día de estos tengo un rato libre para probarlo en profundidad, por que la verdad es que tengo ganas de comprobar de primera mano si el revuelo que ha levantado Wave en la red está fundado o no. Seguiremos informando al respecto. :-)&lt;/p&gt;  &lt;p&gt;Por cierto, &lt;strong&gt;tengo ocho invitaciones &lt;/strong&gt;para otros tantos amigos que quieran probarlo, sólo tenéis que hacerme llegar vuestra dirección de correo electrónico e iré enviando las invitaciones en riguroso orden de llegada.&lt;/p&gt;  &lt;p&gt;Uf, ya sólo tengo siete, vais a tener que daros prisa…&lt;/p&gt;  &lt;br /&gt;&lt;div style="background-color: yellow; padding: 5; border: 1px solid black; color: black;"&gt;Actualizado (15-oct): ya he informado a los afortunados por email, y enviado sus datos a Google Wave, sólo les queda esperar a que les lleguen las invitaciones. Gracias a todos por participar.&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-1511526303900557184?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/1511526303900557184/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=1511526303900557184' title='22 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1511526303900557184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1511526303900557184'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/en-la-onda-con-google-wave.html' title='En la onda, con Google Wave'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>22</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-2435407440805822896</id><published>2009-10-12T23:58:00.002+02:00</published><updated>2009-10-12T23:58:00.372+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frameworks'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='xVal'/><category scheme='http://www.blogger.com/atom/ns#' term='programación'/><title type='text'>xVal, validaciones automáticas para ASP.NET MVC</title><content type='html'>&lt;p&gt;Mientras esperamos impacientes la llegada de ASP.NET MVC 2 con su flamante sistema integrado de validación de datos en cliente y servidor, &lt;a title="xVal en CodePlex" href="http://www.codeplex.com/xval"&gt;xVal&lt;/a&gt; puede sernos de bastante utilidad al ofrecernos prácticamente las mismas funciones previstas para la versión 2, y alguna más :-)&lt;/p&gt;&lt;p&gt;xVal es un framework para aplicaciones ASP.NET MVC 1.0 (y superiores) creado por &lt;a title="Steve Sanderson" href="http://blog.codeville.net/about/" hreflang="en"&gt;Steve Sanderson&lt;/a&gt;&lt;a title="Steve Sanderson" href="http://blog.codeville.net/about/"&gt;&lt;/a&gt;, y &lt;a title="xVal 1.0 now available" href="http://blog.codeville.net/2009/09/17/xval-v10-now-available/"&gt;presentado en sociedad&lt;/a&gt; el pasado 17 de septiembre, que permite validar la información almacenada en clases del modelo, tanto en el lado cliente como en servidor, de forma automatizada.&lt;/p&gt;  &lt;p&gt;Su diseño es muy flexible, permitiéndonos elegir entre distintos marcos de trabajo para la validación en servidor (de serie soporta los atributos &lt;a title="System.ComponentModel.DataAnnotations" href="http://msdn.microsoft.com/es-es/library/system.componentmodel.dataannotations.aspx"&gt;DataAnnotations&lt;/a&gt;, &lt;a title="Castle Validators" href="http://www.castleproject.org/ActiveRecord/documentation/v1rc1/manual/validators.html"&gt;Castle Validator&lt;/a&gt; y &lt;a title="NHibernate Validator" href="https://www.hibernate.org/22.html"&gt;NHibernate Validator&lt;/a&gt;, aunque se pueden crear proveedores personalizados) y librerías en cliente (inicialmente utiliza el magnífico plugin &lt;a title="jQuery Validation" href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/"&gt;jQuery Validation&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" src="http://blog.codeville.net/wp-content/uploads/2009/01/image-thumb.png" width="452" height="173" /&gt;&lt;/p&gt;  &lt;p&gt;Vamos a ver, paso a paso, cómo podemos comenzar a utilizarlo de forma inmediata en nuestras aplicaciones ASP.NET MVC 1.0, utilizando las restricciones &lt;a title="System.ComponentModel.DataAnnotations" href="http://msdn.microsoft.com/es-es/library/system.componentmodel.dataannotations.aspx"&gt;DataAnnotations&lt;/a&gt; y la librería de validación para &lt;a title="jQuery" href="http://jquery.com/"&gt;jQuery&lt;/a&gt; citada anteriormente.&lt;/p&gt;  &lt;h3&gt;1. Preparamos la infraestructura&lt;/h3&gt;  &lt;p&gt;En primer lugar, vamos a preparar el entorno para utilizar el framework de validación:&lt;/p&gt;  &lt;ol&gt;   &lt;br /&gt;&lt;li&gt;Descargamos xVal desde &lt;a title="Descargar xVal" href="http://xval.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33155"&gt;CodePlex&lt;/a&gt;. Se distribuye en un fichero .zip que incluye tanto el ensamblado como archivos de soporte, así que lo descomprimimos en cualquier parte para tener los archivos a mano.       &lt;br /&gt;&lt;/li&gt;    &lt;br /&gt;&lt;li&gt;Descargamos el &lt;a title="jQuery validation" href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/"&gt;plugin de validación de jQuery&lt;/a&gt;, por ejemplo, &lt;a title="Descargar jquery.validate.js" href="http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.min.js"&gt;desde el CDN de Microsoft&lt;/a&gt; (¿qué es el &lt;a title="Microsoft Ajax CDN" href="http://www.variablenotfound.com/2009/09/mas-javascript-en-la-red-microsoft-ajax.html"&gt;Microsoft Ajax CDN&lt;/a&gt;?) y lo incluimos en la carpeta &lt;code&gt;/scripts &lt;/code&gt;de nuestro proyecto. Otra posibilidad sería no descargarlo y referenciarlo directamente nuestras páginas, a gusto del consumidor ;-)       &lt;br /&gt;&lt;/li&gt;    &lt;br /&gt;&lt;li&gt;Añadimos a la carpeta &lt;code&gt;/scripts&lt;/code&gt; del proyecto la librería &lt;code&gt;xVal.jQuery.Validate.js&lt;/code&gt; presente en el raíz del comprimido de xVal. Este archivo, junto con el anterior, son imprescindibles para montar la validación automática en el lado cliente que veremos más adelante. Además, para que los mensajes aparezcan en nuestro idioma, copiamos también al mismo sitio el archivo &lt;code&gt;xVal.Messages.es-ES.js&lt;/code&gt;, disponible en la carpeta “internationalization” del zip.       &lt;br /&gt;&lt;/li&gt;    &lt;br /&gt;&lt;li&gt;Copiamos al directorio &lt;code&gt;/bin &lt;/code&gt;de nuestra aplicación el ensamblado &lt;code&gt;xVal.dll&lt;/code&gt;, o simplemente añadimos una referencia en el proyecto hacia dicho archivo, que encontraréis en el raíz del fichero comprimido que hemos descargado en primer lugar.       &lt;br /&gt;&lt;/li&gt;    &lt;br /&gt;&lt;li&gt;Retocamos ligeramente el Web.config de nuestro proyecto para que sea incluido automáticamente el espacio de nombres &lt;code&gt;xVal.Html&lt;/code&gt; en nuestras vistas, facilitando así el acceso a los helpers suministrados:       &lt;br /&gt;      &lt;br /&gt;      &lt;div id="codeSnippetWrapper"&gt;       &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;         &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;system.web&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;pages&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;namespaces&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #008000"&gt;&amp;lt;!-- Añadir la siguiente línea --&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;namespace&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;xVal.Html&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;namespaces&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;pages&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;system.web&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;/div&gt;  &lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Los pasos comentados hasta el momento son genéricos, es decir, tendremos que realizarlos en todos los proyectos en los que vayamos a utilizar este framework de validación. Podría ser interesante, por tanto, crearnos una plantilla de proyecto en la que tengamos ya todo este trabajo realizado.&lt;/p&gt;&lt;h3&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 10px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Diálogo " border="0" alt="Diálogo " align="right" src="http://lh3.ggpht.com/_O9D62hXq-ng/StN9ww-kxKI/AAAAAAAABIQ/rGgjbDS6U7Y/image%5B8%5D.png?imgmax=800" width="278" height="212" referencia??="referencia??" agregar="agregar" /&gt;2. Definimos las restricciones con &lt;em&gt;Data Annotations&lt;/em&gt;&lt;/h3&gt;&lt;p&gt;Ahora vamos a definir, de forma declarativa, las restricciones que queremos imponer a las propiedades de las clases del modelo, utilizando los atributos denominado &lt;em&gt;data annotations&lt;/em&gt;, distribuidos con .NET 3.5 y originalmente diseñados para trabajar con la tecnología &lt;em&gt;Dynamic Data&lt;/em&gt;.&lt;/p&gt;&lt;ol&gt;  &lt;br /&gt;&lt;li&gt;Dado que vamos a declarar las restricciones utilizando los atributos &lt;em&gt;data annotations, &lt;/em&gt;hay que añadir referencia en el proyecto a&amp;#160; &lt;code&gt;System.ComponentModel.DataAnnotations.       &lt;br /&gt;&lt;/code&gt;&lt;/li&gt;  &lt;br /&gt;&lt;li&gt;A continuación, tenemos que incluir en el proyecto un método que nos permita recorrer las anotaciones de las clases, ejecutarlas e ir generando los errores apropiadamente.&amp;#160; Este método lo utilizaremos más adelante, desde los componentes del Modelo, para comprobar si los valores presentes en las propiedades cumplen los requisitos impuestos por el dominio del sistema.     &lt;br /&gt;    &lt;br /&gt;El código es muy sencillo, el propio Sanderson nos facilita uno en el &lt;a title="Demo de xVal 1.0" href="http://blog.codeville.net/blogfiles/2009/September/BookingsDemo-1.0.zip"&gt;proyecto de demostración de xVal&lt;/a&gt;, que podéis copiar y pegar:     &lt;br /&gt;    &lt;br /&gt;    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; xVal.ServerSide;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.ComponentModel.DataAnnotations;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.ComponentModel;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; MyProject.Validation&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; DataAnnotationsValidationRunner&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; IEnumerable&amp;lt;ErrorInfo&amp;gt; GetErrors(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; instance)&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  {&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    var metadataAttrib = instance.GetType()&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                            .GetCustomAttributes(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(MetadataTypeAttribute), &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                            .OfType&amp;lt;MetadataTypeAttribute&amp;gt;().FirstOrDefault();&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    var buddyClassOrModelClass = metadataAttrib != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; ? &lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                                    metadataAttrib.MetadataClassType:&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                                    instance.GetType();&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    var buddyClassProperties = TypeDescriptor.GetProperties(buddyClassOrModelClass)&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                            .Cast&amp;lt;PropertyDescriptor&amp;gt;();&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    var modelClassProperties = TypeDescriptor.GetProperties(instance.GetType())&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                            .Cast&amp;lt;PropertyDescriptor&amp;gt;();&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; from buddyProp &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; buddyClassProperties&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               join modelProp &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; modelClassProperties on buddyProp.Name equals modelProp.Name&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               from attribute &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; buddyProp.Attributes.OfType&amp;lt;ValidationAttribute&amp;gt;()&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; !attribute.IsValid(modelProp.GetValue(instance))&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               select &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ErrorInfo(&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                            buddyProp.Name, &lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                            attribute.FormatErrorMessage(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Empty), instance);&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  }&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;br /&gt;Ojo, esto sólo tenemos que hacerlo cuando estemos utilizando DataAnnotations, como es el caso; si utilizamos otros frameworks como el de Castle o NHibernate no será necesario, puesto que incluyen ya implementaciones para realizar esta tarea.     &lt;br /&gt;    &lt;br /&gt;&lt;/li&gt;  &lt;br /&gt;&lt;li&gt;Marcamos las propiedades de la entidad del modelo con las restricciones a aplicar durante la validación. Podemos utilizar los atributos disponibles para restringir los valores permitidos en cada propiedad como &lt;code&gt;Required&lt;/code&gt; , &lt;code&gt;StringLength&lt;/code&gt; , &lt;code&gt;Range&lt;/code&gt;&amp;#160; y otros (puedes &lt;a title="DataAnnotations en MSDN" href="http://msdn.microsoft.com/es-es/library/system.componentmodel.dataannotations.aspx"&gt;ver la relación completa aquí&lt;/a&gt;).     &lt;br /&gt;    &lt;br /&gt;Un ejemplo podría ser el siguiente, en el que vemos varias restricciones aplicadas a las propiedades de la entidad:     &lt;br /&gt;    &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Recluta&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, StringLength(30)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Nombre { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, StringLength(40)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Apellidos { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, Range(1, 4)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Talla { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, DataType(DataType.Date)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; DateTime FechaNacimiento { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;/div&gt;    &lt;div&gt;      &lt;br /&gt;Sin embargo, muchos os preguntaréis qué ocurre cuando estas entidades de datos las generamos con herramientas automáticas, como el diseñador de Entity Framework. En estos casos, cada vez que generemos el modelo, las clases serían machacadas por las nuevas versiones, y nuestras anotaciones pasarían a mejor vida.       &lt;br /&gt;      &lt;br /&gt;Afortunadamente, existe la posibilidad de declarar una clase paralela (o, como la llaman, ‘buddy class’), en la que definiremos exclusivamente las propiedades a las que queremos añadir alguna anotación. Además, marcaremos la entidad original (aprovechando que la mayoría de estas herramientas automáticas las generan como parciales) indicando la clase que contiene los metadatos asociados a ésta:       &lt;br /&gt;      &lt;br /&gt;&lt;/div&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Indicamos en la entidad original que los&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// metadatos se encuentran en 'ReclutaMedata'&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;[MetadataType(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ReclutaMetadata))]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;partial&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Recluta&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{ &lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// Nada más que añadir aquí&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// Definimos los metadatos para la entidad 'Recluta'&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ReclutaMetadata&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, StringLength(30)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Nombre { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, StringLength(40)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Apellidos { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, Range(1, 4)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Talla { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [Required, DataType(DataType.Date)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; DateTime FechaNacimiento { get; set; }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;/div&gt;    &lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;    &lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;    &lt;div&gt;      &lt;br /&gt;Como podéis observar, la entidad y la clase de metadatos son prácticamente iguales. Un poco anti-&lt;a title="¡No te repitas!" href="http://es.wikipedia.org/wiki/No_te_repitas"&gt;DRY&lt;/a&gt; sí que es, pero bueno.&lt;/div&gt;  &lt;/li&gt;&lt;/ol&gt;&lt;h3&gt;3. Validamos en servidor&lt;/h3&gt;&lt;p&gt;La propuesta de xVal para el lado del servidor consiste en desplazar la lógica de validación al modelo, dado que es éste el que normalmente impone las restricciones en los datos que han de estar presentes en las entidades del dominio. Una forma de realizarlo sería así:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;por cada entidad, creamos un método que valide la información del mismo, primero invocando al &lt;em&gt;ValidationRunner&lt;/em&gt; (el proceso de validación basado en anotaciones descrito anteriormente), y luego añadiendo aquellas reglas de negocio no incluidas en dichas anotaciones). Un ejemplo podría ser el siguiente:     &lt;br /&gt;    &lt;br /&gt;    &lt;div&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; validar(Recluta recluta)&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    var errors = DataAnnotationsValidationRunner.GetErrors(recluta);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (errors.Any())&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RulesException(errors);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// Regla de negocio adicional: prohibido alistarse reclutas&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// con hermanos en el cuartel...&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (tieneHermanos(recluta.Apellidos))&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RulesException(&lt;span style="color: #006080"&gt;&amp;quot;Apellidos&amp;quot;&lt;/span&gt;,&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #006080"&gt;&amp;quot;El recluta tiene hermanos ya alistados&amp;quot;&lt;/span&gt;, recluta);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;/div&gt;    &lt;div&gt;&amp;#160;&lt;/div&gt;    &lt;div&gt;Este método podría incluirse en la propia entidad &lt;code&gt;Recluta&lt;/code&gt;, o bien donde se implemente la lógica de negocio asociada a la misma.&lt;/div&gt;    &lt;div&gt;&amp;#160;&lt;/div&gt;    &lt;div&gt;En cualquier caso, como se puede observar, cuando se producen errores debido a un incumplimiento de las restricciones indicadas en las anotaciones, se lanza una excepción de tipo &lt;code&gt;RulesException&lt;/code&gt; (facilitada por xVal) que contiene una descripción de los problemas encontrados. Asimismo, la existencia de otro tipo de problemas, hallados de forma programática, son lanzados también en una excepción del mismo tipo.&lt;/div&gt;    &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;/li&gt;  &lt;br /&gt;&lt;li&gt;antes de realizar operaciones susceptibles de modificar el estado del sistema, tenemos que asegurarnos de que las entidades son válidas. Observad, por ejemplo, la implementación del método que nos permite añadir un recluta al sistema:     &lt;br /&gt;    &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Crear(Recluta recluta)&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    validar(recluta);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    reclutas.Add(recluta);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;Si se producen errores en la validación, el método &lt;code&gt;Crear()&lt;/code&gt; será interrumpido por la excepción &lt;code&gt;RulesException&lt;/code&gt; lanzada desde &lt;code&gt;validar()&lt;/code&gt;, y llegará finalmente hasta el Controlador, donde deberá ser procesada.&amp;#160; &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;br /&gt;&lt;li&gt;desde el punto de vista del Controlador, podremos comprobar que el patrón a seguir es realmente sencillo, pues toda la lógica de validación la hemos desplazado al modelo.     &lt;br /&gt;    &lt;br /&gt;El siguiente código muestra los métodos de acción asociados a la creación de una entidad; el primero de ellos simplemente se encarga de mostrar la vista de edición sobre un objeto recién creado, mientras que el segundo obtiene los datos del recluta desde el formulario, e intenta realizar la operación de creación sobre el modelo:     &lt;br /&gt;    &lt;br /&gt;    &lt;div&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Create()&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; View(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Recluta());&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;[AcceptVerbs(HttpVerbs.Post)]&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Create(Recluta recluta)&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        gestorDeReclutas.Crear(recluta);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (RulesException ex)&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        ex.AddModelStateErrors(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ModelState, &lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!ModelState.IsValid)&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; View(recluta);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; RedirectToAction(&lt;span style="color: #006080"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;    &lt;/div&gt;    &lt;div&gt;      &lt;br /&gt;Como se puede observar, se capturan las excepciones de validación que se produzcan al realizar el alta, añadiendo al &lt;code&gt;ModelState&lt;/code&gt; los errores que se estén informando en éstas y, en función de la validez de los datos, enviando al usuario a la vista correspondiente.&lt;/div&gt;  &lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Y esto es todo. Con estas operaciones, ya tenemos las validaciones listas en el lado del servidor, pasemos ahora a solucionarlas en cliente.&lt;/div&gt;&lt;h3&gt;4. Validamos en el cliente&lt;/h3&gt;&lt;p&gt;Está claro que la validación en el lado del servidor es la que única que debemos hacer obligatoriamente; el lado cliente es sensible al equipo del usuario, que puede estar accediendo desde dispositivos sin javascript (o con esta característica desactivada), o incluso puede ser fácilmente manipulado, por lo que no podemos confiar en que los datos lleguen ya siendo válidos.&lt;/p&gt;&lt;p&gt;Sin embargo, ofrecer validación en cliente es una característica imprescindible hoy en día vistas a realizar interfaces muy usables, capaces de ofrecer al usuario feedback inmediato sobre sus acciones.&lt;/p&gt;&lt;p&gt;Con &lt;strong&gt;xVal&lt;/strong&gt;, añadir en este punto validaciones en cliente es realmente sencillo, pues ya tenemos realizado prácticamente todo el trabajo, quedando simplemente:&lt;/p&gt;&lt;ol&gt;  &lt;li&gt;incluir las librerías script en las vistas donde vayamos a realizar la edición de las entidades del modelo. Si vamos a utilizarlas en muchos sitios, lo más fácil es añadirlas a la página maestra:     &lt;br /&gt;    &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;../../Scripts/jquery-1.3.2.min.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;../../Scripts/jquery.validate.min.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;../../Scripts/xVal.jquery.validate.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;../../Scripts/xVal.Messages.es-ES.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;      &lt;br /&gt;&lt;/div&gt;  &lt;/li&gt;  &lt;br /&gt;&lt;li&gt;generar en la vista los scripts de validación de las entidades que nos interesen. En el siguiente código generamos la lógica para la entidad &lt;code&gt;Recluta&lt;/code&gt;:     &lt;br /&gt;&amp;#160; &lt;br /&gt;    &lt;div id="codeSnippetWrapper"&gt;      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;%= Html.ClientSideValidation&amp;lt;MiProyecto.Models.Recluta&amp;gt;() %&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/div&gt;  &lt;/li&gt;&lt;/ol&gt;&lt;h3&gt;5. ¡Y hasta aquí hemos llegado!&lt;/h3&gt;&lt;p&gt;A lo largo de este post hemos recorrido los pasos necesarios para echar a andar el framework xVal en una aplicación ASP.NET MVC 1.0.&lt;/p&gt;&lt;p&gt;Faltan muchos aspectos por comentar, como la posibilidad de utilizar validaciones Ajax en servidor, permitir la localización en decimales, escribir nuestros propios atributos de anotaciones, etc., pero creo que este post ya es lo suficientemente extenso… ya lo veremos en otra ocasión.&lt;/p&gt;&lt;p&gt;Puedes descargar el proyecto de demostración desde Skydrive:&lt;/p&gt;&lt;p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="http://cid-c3a43a99b617d787.skydrive.live.com/embedicon.aspx/P%c3%bablico/variablenotfound.com/ASP.NET%20MVC/ASP.NET%20MVC%201.0/Demo%20xVal%201.0/Demo^_xVal.zip" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-2435407440805822896?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/2435407440805822896/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=2435407440805822896' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2435407440805822896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2435407440805822896'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/xval-validaciones-automaticas-para.html' title='xVal, validaciones automáticas para ASP.NET MVC'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-6846708768530575439</id><published>2009-10-07T17:04:00.001+02:00</published><updated>2009-10-07T17:07:40.232+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='charlas'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><title type='text'>Grabación y materiales de la charla sobre MVC</title><content type='html'>&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Presentación ASP.NET MVC" border="0" alt="Presentación ASP.NET MVC" align="right" src="http://lh5.ggpht.com/_O9D62hXq-ng/SsyuabijtsI/AAAAAAAABIE/yDTBVe2iJb0/image%5B8%5D.png?imgmax=800" width="264" height="210" /&gt;Pues eso, que ya están disponibles para su descarga tanto la grabación del evento como los materiales utilizados durante la charla de ayer, organizada por &lt;a title="Second Nug" href="http://www.secondnug.com/Default.aspx"&gt;Second Nug&lt;/a&gt;, en la que realizamos una introducción al framework ASP.NET MVC.&lt;/p&gt;  &lt;p&gt;En los materiales se incluye tanto el PPT utilizado en la primera parte de la presentación como el código del proyecto que desarrollamos durante la segunda parte, el famoso sistema &lt;strong&gt;Aúpa!net&lt;/strong&gt; ;-), en forma de solución para Visual Web Developer Express 2008 (SP1). Recordad que para poder ejecutarlo y jugar con él necesitáis instalar previamente &lt;a title="Descargar ASP.NET MVC 1.0" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&amp;amp;displaylang=en"&gt;ASP.NET MVC 1.0&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Gracias a todos los que pudisteis asistir al evento en directo (y en especial, los que aguantasteis hasta el final como auténticos campeones ;-)) … bueno, y a los que asistiréis aunque sea off-line ;-P&lt;/p&gt;  &lt;p&gt;Enlaces:&lt;/p&gt;  &lt;table style="margin-left: 50px" border="0" cellspacing="0" cellpadding="2" width="433"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="middle" width="49"&gt;&lt;a title="Acceder a la grabación del evento, en alta fidelidad y WMV" href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032426662&amp;amp;Culture=es-ES"&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="" border="0" alt="" align="left" src="http://lh4.ggpht.com/_O9D62hXq-ng/Ssyuanndt7I/AAAAAAAABII/qgE9YzZSTUk/image%5B29%5D.png?imgmax=800" width="48" height="40" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="middle" width="382"&gt;         &lt;p&gt;&lt;a title="Acceder a la grabación del evento, en alta fidelidad y WMV" href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032426662&amp;amp;Culture=es-ES"&gt;Acceder a la grabación del evento&lt;/a&gt; &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="middle" width="49"&gt;&lt;a title="Descargar materiales del evento" href="http://cid-72370476216aac6e.skydrive.live.com/self.aspx/.Public/MVC/Materiales%20ASP.NET%20MVC.zip"&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="" border="0" alt="" align="left" src="http://lh5.ggpht.com/_O9D62hXq-ng/SsyubG30KWI/AAAAAAAABIM/tZl__nzzyEI/image%5B30%5D.png?imgmax=800" width="44" height="45" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td valign="middle" width="382"&gt;&lt;a title="Descargar materiales del evento" href="http://cid-72370476216aac6e.skydrive.live.com/self.aspx/.Public/MVC/Materiales%20ASP.NET%20MVC.zip"&gt;Descarga de materiales (.zip)&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-6846708768530575439?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/6846708768530575439/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=6846708768530575439' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/6846708768530575439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/6846708768530575439'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/grabacion-y-materiales-de-la-charla.html' title='Grabación y materiales de la charla sobre MVC'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-5703660379937516286</id><published>2009-10-05T13:23:00.000+02:00</published><updated>2009-10-05T13:24:19.063+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='charlas'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><title type='text'>Recordatorio: mañana, ¡a por ASP.NET MVC!</title><content type='html'>&lt;p&gt;Sólo recordaros que mañana martes 6, a las 19:30 (GMT+2), estaré charlando sobre ASP.NET MVC en el evento on-line organizado por &lt;a title="Second Nug" href="http://www.secondnug.com/"&gt;Second Nug&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Durante las dos horas de duración previstas veremos cómo crear una aplicación web completa con esta tecnología alternativa a Webforms, mientras vamos comentando técnicas, detalles y aspectos a tener en cuenta al desarrollar con ASP.NET MVC.&lt;/p&gt;  &lt;p&gt;&lt;a title="Registrarse como asistente del evento" href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032426662&amp;amp;Culture=es-ES"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px auto 5px; display: block; float: none; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_O9D62hXq-ng/SsnHuASv01I/AAAAAAAABIA/SN4ll0rFpOQ/image%5B6%5D.png?imgmax=800" width="472" height="64" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Nos os la perdáis, eh?! ;-)&lt;/p&gt;  &lt;p&gt;Enlaces:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032426662&amp;amp;EventCategory=4&amp;amp;culture=es-ES&amp;amp;CountryCode=ES"&gt;Registrarse como asistente al evento&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://office.microsoft.com/es-es/help/HA101733831033.aspx"&gt;Descarga del software Office Live Meeting&lt;/a&gt; (requerido para asistir) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.secondnug.com/EventosDesarrollo/tabid/57/Default.aspx"&gt;Otros eventos de desarrollo de Second Nug&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Publicado en: &lt;a href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-5703660379937516286?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/5703660379937516286/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=5703660379937516286' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5703660379937516286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5703660379937516286'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/recordatorio-manana-por-aspnet-mvc.html' title='Recordatorio: mañana, ¡a por ASP.NET MVC!'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-7597255266844288176</id><published>2009-10-02T11:32:00.000+02:00</published><updated>2009-10-02T11:32:11.888+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='novedades'/><category scheme='http://www.blogger.com/atom/ns#' term='noticias'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><title type='text'>Publicada la segunda preview de ASP.NET MVC 2</title><content type='html'>&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://lh4.ggpht.com/_O9D62hXq-ng/SsXGBCweQUI/AAAAAAAABH8/Ayhirm7CzyQ/image%5B3%5D.png?imgmax=800" width="172" height="84" /&gt; Ayer mismo anunciaba &lt;a title="ASP.NET MVC 2 Preview 2 Released" href="http://haacked.com/archive/2009/10/01/asp.net-mvc-preview-2-released.aspx" hreflang="en"&gt;Phil Haack&lt;/a&gt;&lt;a title="ASP.NET MVC 2 Preview 2 Released" href="http://haacked.com/archive/2009/10/01/asp.net-mvc-preview-2-released.aspx"&gt;&lt;/a&gt; la publicación de la &lt;a title="ASP.NET MVC 2, Preview 2" href="http://go.microsoft.com/fwlink/?LinkID=154414"&gt;segunda preview de ASP.NET MVC 2&lt;/a&gt;, que continúa profundizando en las mejoras que ya se incluyeron en la primera entrega.&lt;/p&gt;  &lt;p&gt;Según se recoge en el documento de &lt;a title="Release notes" href="http://go.microsoft.com/fwlink/?LinkID=157066" hreflang="en"&gt;notas del producto&lt;/a&gt;&lt;a title="Release notes" href="http://go.microsoft.com/fwlink/?LinkID=157066"&gt;&lt;/a&gt;, las novedades que podremos encontrar son:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Abstracción del proveedor de metadatos, que será útil para implementar nuestros propios sistemas de obtención de metainformación sobre las clases del modelo, aunque por defecto se utilizarán los atributos presentes en &lt;code&gt;System.ComponentModel.DataAnnotations.&lt;/code&gt; &lt;/li&gt;    &lt;li&gt;Abstracción del proveedor de validaciones del modelo, que nos permitirá utilizar mecanismos personalizados de validación durante el proceso de &lt;em&gt;binding&lt;/em&gt;, que por defecto utilizará también las &lt;a title="System.ComponentModel.DataAnnotations" href="http://msdn.microsoft.com/es-es/library/system.componentmodel.dataannotations.aspx"&gt;DataAnnotations&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;Validación automática en cliente, que aunque permite la utilización de otros frameworks, la implementación por defecto utiliza el plugin &lt;a title="jQuery Validation" href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/"&gt;jQuery Validation&lt;/a&gt; para generar en cliente la lógica de validación descrita en los metadatos de las propiedades del modelo. De momento, soporta las siguientes &lt;code&gt;DataAnnotations:&lt;/code&gt;       &lt;ul&gt;       &lt;li&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;StringLengthAttribute, &lt;/code&gt;para limitar el tamaño máximo de un campo texto. &lt;/li&gt;        &lt;li&gt;&lt;code&gt;RequiredAttribute&lt;/code&gt;, para indicar la obligatoriedad de introducir un valor. &lt;/li&gt;        &lt;li&gt;&lt;code&gt;RegexAttribute&lt;/code&gt;, que añade la restricción de obligado cumplimiento de la expresión regular indicada. &lt;/li&gt;        &lt;li&gt;&lt;code&gt;RangeAttribute&lt;/code&gt;, para especificar el rango de valores de un campo (por ejemplo, un entero). &lt;/li&gt;     &lt;/ul&gt; Dado que el &lt;em&gt;model bi&lt;/em&gt;nder implementa las validaciones en servidor, parece que vamos en camino para ahorrarnos el trabajo sucio :-) &lt;/li&gt;    &lt;li&gt;Inclusión del filtro &lt;code&gt;RequireHttpsAttribute&lt;/code&gt;, que aplicado a una acción, fuerza a que ésta sea invocada utilizando el protocolo HTTPS. &lt;/li&gt;    &lt;li&gt;Inclusión del helper Html &lt;code&gt;HttpMethodOverride&lt;/code&gt;, que permite sobrescribir el verbo HTTP enviado por el cliente en aquellos agentes de usuario que no soportan los verbos menos frecuentes (PUT, DELETE…), introduciendo un campo oculto que es detectado posteriormente. &lt;/li&gt;    &lt;li&gt;Posibilidad de incluir áreas en un proyecto único, es decir, sin necesidad de crear proyectos independientes, facilitando además el registro de las mismas. &lt;/li&gt;    &lt;li&gt;El atributo &lt;code&gt;HiddenInputAttribute&lt;/code&gt; permite ahora especificar propiedades del modelo que deben ser renderizadas en cliente con un campo &lt;em&gt;hidden&lt;/em&gt;. &lt;/li&gt;    &lt;li&gt;Y otras mejoras, de las que selecciono sólo algunas:      &lt;ul&gt;       &lt;li&gt;&lt;code&gt;Controller.Execute()&lt;/code&gt; lanzará una excepción cuando sea llamado más de una vez en la misma instancia. Dado que una instancia del controlador debe atender exclusivamente a una petición, es una medida que ayuda a prevenir problemas con contenedores IoC configurados para generar singletons, por ejemplo. &lt;/li&gt;        &lt;li&gt;Inclusión de nuevos verbos HTTP, como PUT o DELETE para facilitar la creación de sistemas REST. &lt;/li&gt;        &lt;li&gt;Soporte para el tipo de datos &lt;code&gt;DataType.Password&lt;/code&gt;, haciendo que se rendericen como cuadros de edición de tipo password las propiedades que sean marcadas con este atributo. &lt;/li&gt;        &lt;li&gt;Se ha establecido como editor para los booleanos anulables un desplegable con las opciones “No especificado”, “Sí” y “No”. &lt;/li&gt;        &lt;li&gt;Mejoras de eficiencia, introduciendo una caché de expresiones compiladas para los helpers que utilizan sintaxis lambda fuertemente tipada. &lt;/li&gt;        &lt;li&gt;(Podéis ver el resto en el documento de &lt;a title="Release notes" href="http://go.microsoft.com/fwlink/?LinkID=157066" hreflang="en"&gt;notas del producto&lt;/a&gt;). &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;De momento todavía no funciona con la beta de Visual Studio 2010, sólo con las versiones 2008 convenientemente servicepackeadas.&lt;/p&gt;  &lt;p&gt;Enlaces:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="Descargar instalable de ASP.NET MVC 2 Preview 2" href="http://go.microsoft.com/fwlink/?LinkID=154414"&gt;Descargar ASP.NET MVC 2 Preview 2&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="Fuentes de ASP.NET MVC 2 Preview 2" href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33836"&gt;Descargar fuentes&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-7597255266844288176?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/7597255266844288176/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=7597255266844288176' title='4 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/7597255266844288176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/7597255266844288176'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/10/publicada-la-segunda-preview-de-aspnet.html' title='Publicada la segunda preview de ASP.NET MVC 2'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-1892996345155022016</id><published>2009-09-28T21:10:00.002+02:00</published><updated>2009-09-28T21:12:51.758+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='charlas'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='servicios on-line'/><title type='text'>Charla en Second Nug sobre ASP.NET MVC</title><content type='html'>&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 10px; display: inline; border-top: 0px; border-right: 0px" title="Cartel del evento" border="0" alt="image" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SsEBm09xt1I/AAAAAAAABH4/gLU7Cpt7dsA/image%5B1%5D.png?imgmax=800" width="296" height="220" /&gt;Los chicos de &lt;a title="Second Nug" href="http://www.secondnug.com/"&gt;Second Nug&lt;/a&gt; han tenido la amabilidad de invitarme a dar una charla sobre ASP.NET MVC el próximo martes 6 de octubre, de 19:30 a 21:30 horas, hora peninsular (GMT+2). Y obviamente, no podía rechazar la oportunidad de hablar un rato sobre esta tecnología de desarrollo de aplicaciones web que tanto me gusta. :-)&lt;/p&gt;  &lt;p&gt;Como otros eventos organizados por el grupo, se trata de un &lt;a title="Qué es un Webcast, en la Wikipedia" href="http://es.wikipedia.org/wiki/Webcast"&gt;Webcast&lt;/a&gt;, la asistencia es gratuita y el aforo ilimitado; sólo necesitáis &lt;a title="Registrarse para el evento" href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032426662&amp;amp;Culture=es-ES"&gt;registraros en el sitio web de Microsoft&lt;/a&gt; y estar el día de autos frente a un ordenador con conexión a Internet, el software gratuito &lt;a title="Descargar Office Live Meeting" href="http://office.microsoft.com/es-es/help/HA101733831033.aspx"&gt;Live Meeting&lt;/a&gt;, y una gran bolsa de palomitas. Dado que el principal objetivo de la sesión será mostrar los conceptos básicos del desarrollo con ASP.NET MVC, no es necesario que contéis con conocimientos previos sobre dicho framework.&lt;/p&gt;  &lt;p&gt;La charla será estructurada como entiendo que deben hacerse estas cosas: poca teoría y mucha acción. Primero describiré algo de la filosofía y principios fundamentales, y seguidamente pasaremos a desarrollar una aplicación completa partiendo desde cero (Archivo&amp;gt;Nuevo&amp;gt;Proyecto), aprovechando cada funcionalidad para comentar técnicas y detalles a tener en cuenta al desarrollar con este marco de trabajo. &lt;/p&gt;  &lt;p&gt;Espero veros por allí, paso lista ;-)&lt;/p&gt;  &lt;p&gt;Enlaces:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="Eventos de desarrollo de Second Nug" href="http://www.secondnug.com/EventosDesarrollo/tabid/57/Default.aspx"&gt;Eventos de desarrollo de Second Nug&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a title="Registrarse como asistente al evento" href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032426662&amp;amp;EventCategory=4&amp;amp;culture=es-ES&amp;amp;CountryCode=ES"&gt;Registrarse como asistente al evento&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a title="Descarga del software Office Live Meeting" href="http://office.microsoft.com/es-es/help/HA101733831033.aspx"&gt;Descarga del software Office Live Meeting&lt;/a&gt; (requerido para asistir) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-1892996345155022016?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/1892996345155022016/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=1892996345155022016' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1892996345155022016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1892996345155022016'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/charla-en-second-nug-sobre-aspnet-mvc.html' title='Charla en Second Nug sobre ASP.NET MVC'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-2014020792677898953</id><published>2009-09-23T23:58:00.000+02:00</published><updated>2009-09-23T23:58:00.374+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><category scheme='http://www.blogger.com/atom/ns#' term='seguridad'/><category scheme='http://www.blogger.com/atom/ns#' term='trucos'/><title type='text'>Eliminar los encabezados X-AspNet* de las respuestas en ASP.NET MVC (y ASP.NET)</title><content type='html'>&lt;p&gt;Si observamos las respuestas enviadas al cliente que solicita una página de un sitio web creado con el framework MVC, veremos que, además de los encabezados HTTP estándar, el sistema añade información sobre las versiones de ASP.NET y del propio framework MVC que estamos utilizando:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px auto 5px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Encabezados X-ASPNet*" border="0" alt="Encabezados X-ASPNet*" src="http://lh6.ggpht.com/_O9D62hXq-ng/Spl65hP6mwI/AAAAAAAABGQ/xgPrDij0U_4/image%5B15%5D.png?imgmax=800" width="390" height="189" /&gt; &lt;/p&gt;  &lt;p&gt;Esta información, además de consumir ancho de banda (poco, todo hay que decirlo, pero nada despreciable en sitios con tráfico muy alto), aportan información que posibles atacantes podrían utilizar para sacar provecho a vulnerabilidades conocidas de estos productos. En mi opinión, lo mejor es mostrar los menores detalles posibles al respecto.&lt;/p&gt;  &lt;p&gt;Si queremos eliminar la pista correspondiente a la versión de ASP.NET sobre la que corre el sistema (X-AspNet-Version), bastaría con introducir en el &lt;em&gt;web.config&lt;/em&gt; la siguiente declaración:     &lt;br /&gt;&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;configuration&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;system.web&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;httpRuntime&lt;/span&gt; &lt;span style="color: #ff0000"&gt;enableVersionHeader&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;system.web&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;configuration&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Para eliminar, además, la información sobre la versión de ASP.NET MVC framework en ejecución (X-AspNetMvc-Version), tendremos que introducir el siguiente código para que se ejecute durante la inicialización de la aplicación, en el global.asax, indicando así que deseamos deshabilitar el envío de este encabezado:   &lt;br /&gt;&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Application_Start()&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    [...] &lt;span style="color: #008000"&gt;// Otro código de inicialización&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    MvcHandler.DisableMvcResponseHeader = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Y con eso basta. El resultado, el que sigue:&lt;/p&gt;&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px auto 5px; display: block; float: none; border-top: 0px; border-right: 0px" title="Encabezados sin información extra" border="0" alt="Encabezados sin información extra" src="http://lh4.ggpht.com/_O9D62hXq-ng/Spl66NJa86I/AAAAAAAABGU/jPg4Kgh_nEE/image%5B20%5D.png?imgmax=800" width="372" height="135" /&gt; &lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-2014020792677898953?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/2014020792677898953/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=2014020792677898953' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2014020792677898953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2014020792677898953'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/eliminar-los-encabezados-x-aspnet-de.html' title='Eliminar los encabezados X-AspNet* de las respuestas en ASP.NET MVC (y ASP.NET)'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-5260813168294877209</id><published>2009-09-21T01:12:00.001+02:00</published><updated>2009-09-21T01:12:00.565+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='novedades'/><category scheme='http://www.blogger.com/atom/ns#' term='bases de datos'/><category scheme='http://www.blogger.com/atom/ns#' term='orm'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='software libre'/><category scheme='http://www.blogger.com/atom/ns#' term='interfaces fluidos'/><title type='text'>Fluent NHibernate 1.0 publicado</title><content type='html'>&lt;p&gt;A finales del agosto, &lt;a title="Anuncio del lanzamiento de Fluent NHibernate" href="http://nhforge.org/blogs/nhibernate/archive/2009/08/29/fluent-nhibernate-1-0.aspx" hreflang="en"&gt;James Gregory&lt;/a&gt;&lt;a title="Anuncio del lanzamiento de Fluent NHibernate" href="http://nhforge.org/blogs/nhibernate/archive/2009/08/29/fluent-nhibernate-1-0.aspx"&gt;&lt;/a&gt; anunció la publicación de la versión 1.0 de &lt;a title="Fluent NHibernate home" href="http://fluentnhibernate.org/"&gt;Fluent NHibernate&lt;/a&gt;, una librería que ofrece una ágil alternativa a los espesos archivos de configuración de &lt;a title="NHibernate" href="http://nhforge.org/"&gt;NHibernate&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Su API permite configurar desde el código de una aplicación, de &lt;a title="Interfaces fluidos en Variable not found" href="http://www.variablenotfound.com/2007/11/interfaces-fluidos-fluent-interfaces.html"&gt;forma fluida&lt;/a&gt; la mayoría de las veces, los mapeos entre la estructura de una base de datos relacional y el modelo de objetos que utiliza. Así, evitaremos la manipulación de grandes archivos XML, a la vez que podremos beneficiarnos de la validación en tiempo de compilación y, por supuesto, de posibilidades como la refactorización y el intellisense durante el desarrollo.&lt;/p&gt;  &lt;p&gt;El siguiente código muestra el mapeo de la entidad &lt;code&gt;Cat&lt;/code&gt; con sus propiedades, algunas de ellas con restricciones, y relaciones con otras entidades a uno (&lt;code&gt;References&lt;/code&gt;) y a varios (&lt;code&gt;HasMany&lt;/code&gt;); el nombre de la tabla y campos en el modelo relacional es el mismo que el de las propiedades, gracias a la &lt;a title="Convención sobre configuración, en la wikipedia" href="http://es.wikipedia.org/wiki/Convenci%C3%B3n_sobre_Configuraci%C3%B3n"&gt;convención sobre configuración&lt;/a&gt;, lo que permite simplificar código respecto a su equivalente XML:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; CatMap : ClassMap&amp;lt;Cat&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; CatMap()&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  {&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Id(x =&amp;gt; x.Id);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Map(x =&amp;gt; x.Name)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      .Length(16)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      .Not.Nullable();&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    Map(x =&amp;gt; x.Sex);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    References(x =&amp;gt; x.Mate);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    HasMany(x =&amp;gt; x.Kittens);&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  }&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Como podemos observar, el equivalente XML es mucho más verboso:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;hibernate-mapping&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;urn:nhibernate-mapping-2.2&amp;quot;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #ff0000"&gt;namespace&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;QuickStart&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;assembly&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;QuickStart&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;class&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Cat&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;table&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Cat&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;id&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Id&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;generator&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;identity&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;property&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;column&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Name&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;length&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;16&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;not-null&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;property&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Sex&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;many-to-one&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Mate&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;bag&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Kittens&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;key&lt;/span&gt; &lt;span style="color: #ff0000"&gt;column&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;mother_id&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;one-to-many&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Cat&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;bag&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;hibernate-mapping&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Otra de las ventajas que aporta es el &lt;a title="Auto-mapping en Fluent NHibernate" href="http://wiki.fluentnhibernate.org/Auto_mapping" hreflang="en"&gt;auto-mapping&lt;/a&gt;&lt;a title="Auto-mapping en Fluent NHibernate" href="http://wiki.fluentnhibernate.org/Auto_mapping"&gt;&lt;/a&gt;, que hace utilización intensiva del principio de convención sobre configuración para generar de forma automática mapeos de aquellas entidades que atiendan a unas normas preestablecidas (aunque modificables). El siguiente código muestra la forma tan sencilla de crear los mapeos de todas las entidades definidas en el espacio de nombres &lt;code&gt;MiApp.Entidades&lt;/code&gt;, dentro del ensamblado donde se definió la entidad &lt;code&gt;Producto&lt;/code&gt;:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var autoMappings = AutoMap.AssemblyOf&amp;lt;Producto&amp;gt;()&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  .Where(t =&amp;gt; t.Namespace == &lt;span style="color: #006080"&gt;&amp;quot;MiApp.Entidades&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;br /&gt;Además del mapeo objeto-relacional, el software abarca también la configuración del acceso a datos de NHibernate a través de su interfaz de programación. El siguiente código muestra la inicialización de la conexión a una base de datos SQL Server 2005, tomando la cadena de conexión del &lt;code&gt;AppSettings&lt;/code&gt; y mapeando automáticamente las entidades que se encuentren definidas en un &lt;em&gt;namespace&lt;/em&gt; concreto:&lt;/div&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var sessionFactory = Fluently.Configure()&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    .Database(MsSqlConfiguration.MsSql2005&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      .ConnectionString(c =&amp;gt; c.FromAppSetting(&lt;span style="color: #006080"&gt;&amp;quot;connectionString&amp;quot;&lt;/span&gt;))&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    .Mappings(m =&amp;gt; m.AutoMappings.Add(&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;      AutoMap.AssemblyOf&amp;lt;Producto&amp;gt;(type =&amp;gt; type.Namspace.EndsWith(&lt;span style="color: #006080"&gt;&amp;quot;Entidades&amp;quot;&lt;/span&gt;))))&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  .BuildSessionFactory();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Y por último, hay otra característica muy interesante vistas a la realización de pruebas unitarias sobre los mecanismos de persistencia. El código mostrado a continuación crea una instancia de la clase &lt;code&gt;Empleado&lt;/code&gt;, la inserta en la base de datos, realiza una lectura de la entidad y la compara con la original, de forma automática:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;[Test]&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; EmpleadoMapeaCorrectamente()&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PersistenceSpecification&amp;lt;Empleado&amp;gt;(session)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .CheckProperty(emp =&amp;gt; emp.Id, 1)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .CheckProperty(emp =&amp;gt; emp.Nombre, &lt;span style="color: #006080"&gt;&amp;quot;José&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .CheckProperty(emp =&amp;gt; emp.Apellidos, &lt;span style="color: #006080"&gt;&amp;quot;Aguilar&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .VerifyTheMappings();&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Más información en la &lt;a title="Wiki de Fluent NHibernate" href="http://wiki.fluentnhibernate.org/Main_Page" hreflang="en"&gt;wiki del proyecto&lt;/a&gt;&lt;a title="Wiki de Fluent NHibernate" href="http://wiki.fluentnhibernate.org/Main_Page"&gt;&lt;/a&gt;. Y las descargas, desde &lt;a title="Download Fluent NHibernate" href="http://fluentnhibernate.org/downloads" hreflang="en"&gt;aquí&lt;/a&gt;&lt;a title="Download Fluent NHibernate" href="http://fluentnhibernate.org/downloads"&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-5260813168294877209?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/5260813168294877209/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=5260813168294877209' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5260813168294877209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/5260813168294877209'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/fluent-nhibernate-10-publicado.html' title='Fluent NHibernate 1.0 publicado'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-7900787154330901659</id><published>2009-09-16T17:36:00.000+02:00</published><updated>2009-09-16T17:36:52.943+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='novedades'/><category scheme='http://www.blogger.com/atom/ns#' term='noticias'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='servicios on-line'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>Más javascript en la red: Microsoft Ajax CDN</title><content type='html'>&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Logo de ASP.NET Ajax" border="0" alt="Logo de ASP.NET Ajax" align="right" src="http://lh4.ggpht.com/_O9D62hXq-ng/SrEFUUuZDiI/AAAAAAAABHo/EE6wrdelvv8/image%5B5%5D.png?imgmax=800" width="224" height="85" /&gt; Hace unos meses comentaba la posibilidad de utilizar la infraestructura de &lt;a title="Deja que Google aloje tus librerías javascript" href="http://www.variablenotfound.com/2009/02/deja-que-google-aloje-tus-librerias.html"&gt;Google para alojar las librerías javascript&lt;/a&gt; de nuestras aplicaciones. Pues bien, ahora es Microsoft la que ha lanzado un servicio similar, &lt;a title="Microsoft Ajax CDN" href="http://www.asp.net/ajax/cdn/" hreflang="en"&gt;Microsoft Ajax CDN&lt;/a&gt;&lt;a title="Microsoft Ajax CDN" href="http://www.asp.net/ajax/cdn/"&gt;&lt;/a&gt;, una red de distribución de contenidos desde donde podemos descargar en tiempo de ejecución las librerías de scripts que utilicemos en nuestras aplicaciones.&lt;/p&gt;  &lt;p&gt;O en otras palabras, que podemos hacer uso de forma gratuita de estas librerías, sin limitación de ancho de banda e independientemente de si es para fines comerciales o no. Basta con referenciarlas desde nuestro código:&lt;/p&gt;  &lt;div&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt; &lt;span style="color: #ff0000"&gt;src&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://ajax.microsoft.com/ajax/jquery-1.3.2.min.js&amp;quot;&lt;/span&gt; &lt;br /&gt;        &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;La principal ventaja que ofrece este método es la velocidad con la que estos archivos serán servidos, puesto que se usa la infraestructura del gigante de Redmon, a la vez que se comparte la caché con otros sitios web que también las estén utilizando. También brinda la posibilidad de utilizar scripting a sitios web que no disponen de permisos para subir archivos (como la plataforma &lt;a title="Blogger" href="http://www.blogger.com"&gt;blogger&lt;/a&gt;)&lt;/p&gt;&lt;p&gt;A diferencia del servicio de Google, desde esta CDN sólo podemos encontrar de momento las librerías que oficialmente forman parte de la plataforma de desarrollo de Microsoft, como las propias de ASP.NET Ajax, jQuery y aquellos plugins que vayan añadiéndose. En la dirección &lt;a title="http://www.asp.net/ajax/cdn/" href="http://www.asp.net/ajax/cdn/" hreflang="en"&gt;http://www.asp.net/ajax/cdn/&lt;/a&gt; pueden consultarse la lista completa de librerías, con sus correspondientes direcciones de descarga.&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="EnableCdn en ScriptManager" border="0" alt="EnableCdn en ScriptManager" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SrEFU8QVFCI/AAAAAAAABHs/8IhvgLf_Qv0/image%5B2%5D.png?imgmax=800" width="244" height="122" /&gt;&lt;/p&gt;&lt;p&gt;Adicionalmente, Scott Guthrie &lt;a title="Anunciando Microsoft Ajax CDN" href="http://weblogs.asp.net/scottgu/archive/2009/09/15/announcing-the-microsoft-ajax-cdn.aspx" hreflang="en"&gt;comentaba en su blog&lt;/a&gt; que el nuevo control &lt;code&gt;ScriptManager&lt;/code&gt; que vendrá con ASP.NET 4.0 incluye una propiedad llamada &lt;code&gt;EnableCdn&lt;/code&gt; que permitirá activar la descarga de las librerías Ajax y todas aquellas necesarias para el funcionamiento de controles, directamente desde sus servidores. &lt;/p&gt;&lt;p&gt;Los inconvenientes, pues los mismos que los del servicio de Google: si no disponemos de conexión a la red en tiempo de desarrollo, podemos tenerlo realmente crudo.&lt;/p&gt;&lt;p&gt;Más información en: &lt;a href="http://www.asp.net/ajax/cdn"&gt;www.asp.net/ajax/cdn&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-7900787154330901659?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/7900787154330901659/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=7900787154330901659' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/7900787154330901659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/7900787154330901659'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/mas-javascript-en-la-red-microsoft-ajax.html' title='Más javascript en la red: Microsoft Ajax CDN'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-8369991820018378876</id><published>2009-09-15T23:59:00.001+02:00</published><updated>2009-09-15T23:59:00.262+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='trucos'/><title type='text'>Inicializar a null propiedades sin tipo</title><content type='html'>&lt;p&gt;No es algo que ocurra muy frecuentemente, pero en determinadas ocasiones puede ser útil inicializar una propiedad de un tipo anónimo con el valor nulo, por ejemplo:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt; &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var conductor = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; { Nombre = ”Marisa”, Edad = 34, Auto = “Renault Megane” };&lt;/pre&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var peaton = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; { Nombre = “Juan”, Edad = 43, Auto = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; };&lt;/pre&gt; &lt;!--CRLF--&gt;&lt;/div&gt; &lt;/div&gt;&lt;p&gt;En el código anterior se entiende que lo que queremos indicar estableciendo la propiedad &lt;code&gt;Auto&lt;/code&gt; a &lt;code&gt;null&lt;/code&gt; es que la persona que estamos representando no dispone de automóvil, o bien no conocemos este dato.&lt;/p&gt;&lt;p&gt;Algo muy normal… sino fuera porque el compilador se empeña en abofetearnos con el siguiente error:&lt;/p&gt;&lt;blockquote&gt; &lt;p&gt;Cannot assign &amp;lt;null&amp;gt; to anonymous type property&lt;/p&gt; &lt;/blockquote&gt;&lt;p&gt;Y la verdad, en cuanto lo pensamos un poco, tiene sentido. En los casos anteriores, se está instanciando un tipo anónimo cuyas propiedades son generadas en tiempo de compilación. En el caso anterior, el compilador crearía para el tipo anónimo una propiedad “Nombre” de tipo &lt;code&gt;string&lt;/code&gt;, una “Edad” de tipo &lt;code&gt;integer&lt;/code&gt;, y una “Auto”, de tipo… ¿qué tipo podría asignar el compilador a esta propiedad? Ese es precisamente el  problema.&lt;/p&gt;&lt;p&gt;Lo mismo ocurre al intentar inicializar variables implícitamente tipadas con el valor nulo; aunque cambia el error, el concepto idéntico, el compilador no es capaz de inferir el tipo de la variable:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt; &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var persona = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;; // Error: Cannot assign &amp;lt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&amp;gt; to an implicitly-typed local variable&lt;/pre&gt; &lt;!--CRLF--&gt;&lt;/div&gt; &lt;/div&gt;&lt;p&gt;La forma de solucionarlo en ambos casos es muy sencilla: basta con informar explícitamente al compilador del tipo de la propiedad, para que pueda crearla sin problema, por ejemplo así:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt; &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var peaton = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; { Nombre = &lt;span style="color: #006080"&gt;&amp;quot;Juan&amp;quot;&lt;/span&gt;, Edad = 43, Auto = (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;)&lt;span style="color: #0000ff"&gt;null&lt;/span&gt; };&lt;/pre&gt; &lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;var persona = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; Persona;&lt;/pre&gt; &lt;!--CRLF--&gt;&lt;/div&gt; &lt;/div&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-8369991820018378876?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/8369991820018378876/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=8369991820018378876' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/8369991820018378876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/8369991820018378876'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/inicializar-null-propiedades-sin-tipo.html' title='Inicializar a null propiedades sin tipo'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-57794275951976296</id><published>2009-09-13T23:58:00.000+02:00</published><updated>2009-09-13T23:58:00.430+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='proyectos'/><category scheme='http://www.blogger.com/atom/ns#' term='equipos'/><category scheme='http://www.blogger.com/atom/ns#' term='humor'/><category scheme='http://www.blogger.com/atom/ns#' term='scrum'/><title type='text'>¿Comprometidos o involucrados?</title><content type='html'>&lt;p&gt;Juan Palacio, en su genial &lt;a title="Navegápolis" href="http://www.navegapolis.net/"&gt;Navegápolis&lt;/a&gt;, publicó semanas atrás unos buenos materiales de un &lt;a title="Curso Abierto de SCRUM" href="http://www.navegapolis.net/content/view/916/62/"&gt;Curso de Scrum&lt;/a&gt; en los que he podido recordar una historieta que encontré hace tiempo sobre la diferencia entre la implicación y el compromiso en la realización de un proyecto:&lt;/p&gt;  &lt;p&gt;&lt;a title="Historia de la gallina y el cerdo" href="http://www.implementingscrum.com/translations/"&gt;&lt;img style="border-right-width: 0px; margin: 0px auto 5px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="La historia de la gallina y el cerdo" border="0" alt="La historia de la gallina y el cerdo" src="http://lh5.ggpht.com/_O9D62hXq-ng/SpV646d4NVI/AAAAAAAABF4/lNDEWE2GBIw/image%5B5%5D.png?imgmax=800" width="629" height="224" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Aunque esta metáfora se utiliza en &lt;a title="Scrum en la wikipedia" href="http://es.wikipedia.org/wiki/Scrum"&gt;Scrum&lt;/a&gt; para agrupar los roles principales distinguiendo entre aquellos que ponen “la carne en el asador” (cerdos), y el resto de afectados y participantes (gallinas), es igualmente aplicable a las actitudes de los componentes de un equipo de trabajo, independientemente de la metodología utilizada.&lt;/p&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-57794275951976296?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/57794275951976296/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=57794275951976296' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/57794275951976296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/57794275951976296'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/comprometidos-o-involucrados.html' title='¿Comprometidos o involucrados?'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-1183914987664047203</id><published>2009-09-09T21:18:00.000+02:00</published><updated>2009-09-09T21:18:26.620+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='novedades'/><category scheme='http://www.blogger.com/atom/ns#' term='bases de datos'/><category scheme='http://www.blogger.com/atom/ns#' term='orm'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='linq'/><title type='text'>Linq para NHibernate, versión 1.0</title><content type='html'>&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Logo de NHibernate " border="0" alt="Logo de NHibernate " align="right" src="http://lh4.ggpht.com/_O9D62hXq-ng/SpwQo3u0CBI/AAAAAAAABHQ/XAoSod8e28c/image3.png?imgmax=800" width="246" height="66" /&gt; Hace unas semanas, &lt;a href="http://ayende.com/blog"&gt;Oren Eini&lt;/a&gt; (o Ayende Raihen, como se le suele conocer) &lt;a title="Linq para NHibernate, v1.0" href="http://ayende.com/Blog/archive/2009/07/26/nhibernate-linq-1.0-released.aspx"&gt;comunicaba&lt;/a&gt; la liberación de la versión 1.0 del proveedor de Linq para NHibernate, una característica altamente demandada por los usuarios desde la aparición del lenguaje de consulta integrado en .NET.&lt;/p&gt;  &lt;p&gt;Aunque será incluido como parte del producto NHibernate en versiones venideras, han decidido liberar la actual release del proveedor como paquete independiente para que pueda comenzar a utilizarse desde este momento. Está siendo testado en multitud de aplicaciones en producción desde hace varios años, y al parecer el funcionamiento es más que correcto.&lt;/p&gt;  &lt;p&gt;¿Y cómo puede ayudarte este proveedor, si eres usuario de NHibernate? El siguiente ejemplo, tomado de &lt;a title="Ejemplo de simplificación de consulta con Linq" href="http://www.caffeinatedcoder.com/linq-to-nhibernate/"&gt;Caffeinated Coder&lt;/a&gt; muestra cómo una consulta a base de datos puede simplificarse y hacerse mucho más legible utilizando Linq, además de beneficiarse del tipado fuerte, intellisense y comprobaciones en tiempo de compilación:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Utilizando el API de NHibernate:&lt;/strong&gt;&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IList&amp;lt;Call&amp;gt; GetCallsByDate(DateTime beginDate, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; interpreterId)   &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{   &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    ICriteria criteria = Session.CreateCriteria(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(Call))&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .CreateAlias(&lt;span style="color: #006080"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .Add(Restrictions.Gt(&lt;span style="color: #006080"&gt;&amp;quot;StartTime&amp;quot;&lt;/span&gt;, beginDate))&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .Add(&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            Restrictions.Or(&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                Restrictions.Lt(&lt;span style="color: #006080"&gt;&amp;quot;EndTime&amp;quot;&lt;/span&gt;, DateTime.Now), Restrictions.IsNull(&lt;span style="color: #006080"&gt;&amp;quot;EndTime&amp;quot;&lt;/span&gt;))&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            )&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .Add(Restrictions.Eq(&lt;span style="color: #006080"&gt;&amp;quot;Interpreter.Id&amp;quot;&lt;/span&gt;, interpreterId))&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .AddOrder(Order.Desc(&lt;span style="color: #006080"&gt;&amp;quot;StartTime&amp;quot;&lt;/span&gt;))&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        .AddOrder(Order.Desc(&lt;span style="color: #006080"&gt;&amp;quot;Customer.Name&amp;quot;&lt;/span&gt;)); &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; criteria.List&amp;lt;Call&amp;gt;() &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; List&amp;lt;Call&amp;gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Utilizando Linq:&lt;/strong&gt;&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IList&amp;lt;Call&amp;gt; GetCallsByDateWithLinq(DateTime beginDate, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; interpreterId)  &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{   &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    var query = from call &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; Session.Linq&amp;lt;Call&amp;gt;()&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; call.StartTime &amp;gt; beginDate&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &amp;amp;&amp;amp; (call.EndTime == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; || call.EndTime &amp;lt; DateTime.Now )   &lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &amp;amp;&amp;amp; call.Interpreter.Id == interpreterId&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        orderby call.StartTime descending, call.Customer.Name&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        select call;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; query.ToList();&lt;/pre&gt;&lt;!--CRLF--&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Podéis descargar tanto los binarios como el código fuente desde la &lt;a title="NHibernate Linq project" href="http://sourceforge.net/projects/nhibernate/"&gt;página del proyecto en SourceForge&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-1183914987664047203?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/1183914987664047203/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=1183914987664047203' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1183914987664047203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/1183914987664047203'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/linq-para-nhibernate-version-10.html' title='Linq para NHibernate, versión 1.0'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27752126.post-2968570127061936910</id><published>2009-09-07T22:28:00.000+02:00</published><updated>2009-09-07T22:28:07.986+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chuletas'/><category scheme='http://www.blogger.com/atom/ns#' term='desarrollo'/><category scheme='http://www.blogger.com/atom/ns#' term='aspnetmvc'/><title type='text'>Posters sobre ASP.NET MVC</title><content type='html'>&lt;p&gt;&lt;a title="BB&amp;amp;D" href="http://www.bbd.co.za"&gt;BB&amp;amp;D&lt;/a&gt; a través de su iniciativa &lt;a title="Developer Readiness Program" href="http://www.drp.co.za/Home/tabid/37/Default.aspx"&gt;DRP&lt;/a&gt; ha incluido en su ya extenso &lt;a title="Posters" href="http://www.drp.co.za/Posters/tabid/58/Default.aspx"&gt;repositorio de posters&lt;/a&gt; que abarcan innumerables temáticas (arquitectura, modelado, desarrollo, sistemas operativos, etc.), cuatro &lt;a title="Chuletas ASP.NET MVC" href="http://www.drp.co.za/Posters/Development/tabid/67/Default.aspx"&gt;chuletas sobre ASP.NET MVC&lt;/a&gt; a las que vale la pena echarles un vistazo:&lt;/p&gt;  &lt;table border="0" cellspacing="5" cellpadding="2" width="561"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="168"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SqKwCN3LLLI/AAAAAAAABHU/L6NFLfNYcqw/image%5B23%5D.png?imgmax=800" width="161" height="122" /&gt; &lt;/td&gt;        &lt;td valign="top" width="376"&gt;&lt;strong&gt;ASP.NET MVC Framework Cheat Sheet           &lt;br /&gt;&lt;/strong&gt;Información genérica sobre el framework, que incluye la estructura de carpetas de los proyectos de este tipo, la sintaxis del mapeo de rutas, un diagrama del patrón MVC y el ciclo de vida de las peticiones.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="173"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://lh6.ggpht.com/_O9D62hXq-ng/SqKwDBb_65I/AAAAAAAABHY/B9_AePkRm6I/image%5B32%5D.png?imgmax=800" width="161" height="122" /&gt; &lt;/td&gt;        &lt;td valign="top" width="373"&gt;&lt;strong&gt;ASP.NET MVC Controller Cheat Sheet           &lt;br /&gt;&lt;/strong&gt;Muestra los diferentes tipos de ActionResult disponibles, una relación de atributos con sus usos (filtros, selectores de acciones y enlaces de datos), reglas para la definición de métodos de acción&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="176"&gt;&lt;a href="http://lh5.ggpht.com/_O9D62hXq-ng/SqKwJKtGVDI/AAAAAAAABHc/IbWyqNmU26c/s1600-h/image%5B17%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://lh4.ggpht.com/_O9D62hXq-ng/SqKwKcuI8PI/AAAAAAAABHg/3ve7JCoYWC4/image_thumb.png?imgmax=800" width="161" height="122" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="top" width="371"&gt;&lt;strong&gt;ASP.NET MVC View Cheat Sheet           &lt;br /&gt;&lt;/strong&gt;Referencia rápida de los helpers &lt;code&gt;Html &lt;/code&gt;y &lt;code&gt;Url&lt;/code&gt;, las directivas de declaración de vistas, y las distintas formas de enviar contenidos al cliente. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="178"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/_O9D62hXq-ng/SqKwL29RYqI/AAAAAAAABHk/BmWFCjaluus/image%5B20%5D.png?imgmax=800" width="161" height="122" /&gt; &lt;/td&gt;        &lt;td valign="top" width="369"&gt;&lt;strong&gt;ASP.NET MVC Proven Practices           &lt;br /&gt;&lt;/strong&gt;Contiene algunos consejos y buenas prácticas al desarrollar una aplicación con el framework.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Así que ya sabéis, si todavía os queda espacio en la pared y necesitáis tener a mano una referencia rápida de ASP.NET MVC, id preparando impresora y chinchetas ;-)&lt;/p&gt;  &lt;p&gt;Publicado en: &lt;a title="Variable Not Found" href="http://www.variablenotfound.com/"&gt;Variable not found&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27752126-2968570127061936910?l=www.variablenotfound.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.variablenotfound.com/feeds/2968570127061936910/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=27752126&amp;postID=2968570127061936910' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2968570127061936910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27752126/posts/default/2968570127061936910'/><link rel='alternate' type='text/html' href='http://www.variablenotfound.com/2009/09/posters-sobre-aspnet-mvc.html' title='Posters sobre ASP.NET MVC'/><author><name>José M. Aguilar</name><uri>http://www.blogger.com/profile/11683750380776435448</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13204222613663593069'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry></feed>