<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Darth Dog</title>
        <link>http://blogs.ugidotnet.org/darthdog/Default.aspx</link>
        <description>Il blog di Andrea Canegrati</description>
        <language>it-IT</language>
        <copyright>Andrea Canegrati</copyright>
        <generator>Subtext Version 2.6.0.0</generator>
        <image>
            <title>Darth Dog</title>
            <url>http://blogs.ugidotnet.org/images/RSS2Image.gif</url>
            <link>http://blogs.ugidotnet.org/darthdog/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Storie di NServiceBus :)</title>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2011/10/21/storie-di-nservicebus.aspx</link>
            <description>&lt;p&gt;&lt;font face=""&gt;Mi sono imbattuto in questo link che racconta una "storia vissuta" relativa a NServiceBus:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=""&gt;&lt;a href="http://www.make-awesome.com/2011/02/my-nservicebus-moment-of-bliss/"&gt;http://www.make-awesome.com/2011/02/my-nservicebus-moment-of-bliss/&lt;br /&gt;
&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/100463.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2011/10/21/storie-di-nservicebus.aspx</guid>
            <pubDate>Fri, 21 Oct 2011 10:12:02 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2011/10/21/storie-di-nservicebus.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/100463.aspx</wfw:commentRss>
        </item>
        <item>
            <title>NHibernate : dynamic-component e dominio estendibile</title>
            <category>NHibernate</category>
            <category>DDD</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2011/01/30/nhibernate-dynamic-component-e-dominio-estendibile.aspx</link>
            <description>In questi giorni sto utilizzando una funzionalità piuttosto interessante di NHibernate, ovvero la possibilità di mappare un domain model "dinamico" tramite &lt;span style="font-weight: bold;"&gt;dynamic-component&lt;/span&gt;.&lt;br /&gt;
Questa funzionalità permette di mappare in modo speciale alcune colonne di una tabella di un entità, infatti al posto di utilizzarle come singole proprietà vengono inserite in un dictionary (possono essere sia tipo semplici che vere e proprie entity).&lt;br /&gt;
&lt;br /&gt;
Qui un link che mostra il funzionamento :&lt;br /&gt;
&lt;br /&gt;
&lt;a target="_blank" href="http://ayende.com/Blog/archive/2009/04/11/nhibernate-mapping-ltdynamic-componentgt.aspx"&gt;http://ayende.com/Blog/archive/2009/04/11/nhibernate-mapping-ltdynamic-componentgt.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Qui invece un link che  mostra come modificare la configurazione senza agire sul file di mapping, ma editando "on-the-fly" prima che la session-factory venga creata:&lt;br /&gt;
&lt;br /&gt;
&lt;a target="_blank" href="http://www.junasoftware.com/blog/custom-domain-using-nhibernate-dynamic-component.aspx"&gt;http://www.junasoftware.com/blog/custom-domain-using-nhibernate-dynamic-component.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Ad un primo sguardo può sembrare un comportamento particolare, ma può  venire in aiuto quando si gestisce un sistema "modulare" dove uno dei  requisiti è quello di creare plugin indipententi fra di loro, senza  agire sul "core" del sistema.&lt;br /&gt;
In questo modo ci è possibile estendere una entity aggiungendo delle proprietà custom che non sono conosciute all'interno del modulo base, ma vengono gestite unicamente nel plugin dedicato.&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/99664.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2011/01/30/nhibernate-dynamic-component-e-dominio-estendibile.aspx</guid>
            <pubDate>Sun, 30 Jan 2011 22:13:52 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2011/01/30/nhibernate-dynamic-component-e-dominio-estendibile.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/99664.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Sample App DDD</title>
            <category>.NET</category>
            <category>Patterns</category>
            <category>DDD</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2010/09/01/sample-app-ddd.aspx</link>
            <description>Navigando mi sono imbattuto in questo link : &lt;a href="http://microsoftnlayerapp.codeplex.com/"&gt;http://microsoftnlayerapp.codeplex.com/&lt;/a&gt;.&lt;br /&gt;
Riprendo direttamente dalla descrizione del progetto :&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-style: italic;"&gt;Domain Oriented N-Layered .NET 4.0 Sample App.&lt;/span&gt;&lt;br style="font-style: italic;" /&gt;
&lt;span style="font-style: italic;"&gt;By Microsoft - Spain&lt;/span&gt;&lt;br style="font-style: italic;" /&gt;
&lt;br style="font-style: italic;" /&gt;
&lt;span style="font-style: italic;"&gt;Using .NET 4.0 C#, Entity Framework 4.0 &lt;/span&gt;&lt;br style="font-style: italic;" /&gt;
&lt;span style="font-style: italic;"&gt;Implementing typical DDD architecture &amp;amp; desing patterns&lt;/span&gt;&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/99134.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2010/09/01/sample-app-ddd.aspx</guid>
            <pubDate>Wed, 01 Sep 2010 13:58:49 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2010/09/01/sample-app-ddd.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/99134.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Si parte, siamo tutti pronti?</title>
            <category>Varie</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2010/06/18/si-parte-siamo-tutti-pronti.aspx</link>
            <description>Eccomi qua, dopo il post di &lt;a href="http://blogs.ugidotnet.org/duz/archive/2010/06/15/countdown-avviato-tutto-pronto.aspx"&gt;Mario&lt;/a&gt; direi che c'è poco da aggiungere :)&lt;br /&gt;
Finalmente  sono aperte le iscrizioni al &lt;a href="http://www.dotnetteria.it/Public/EventDetails.aspx?event=efcb0cdd-c942-480a-af67-5a10983cc23e"&gt;primo evento della DotNetteria&lt;/a&gt;....si  lo so, i posti non sono molti, ma siamo davvero molto contenti  dell'evento e delle sessioni che lo compongono! Io in prima persona sarò spettatore interessato, in quanto sono sempre stato "affascinato" da Silverlight.&lt;br /&gt;
Non posso fare altro  che ringraziare tutti quelli che hanno partecipato alle fasi  organizzative e che prenderanno parte all'evento.&lt;br /&gt;
&lt;br /&gt;
Allora ci si  vede lì? :)&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/98813.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2010/06/18/si-parte-siamo-tutti-pronti.aspx</guid>
            <pubDate>Fri, 18 Jun 2010 10:23:16 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2010/06/18/si-parte-siamo-tutti-pronti.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/98813.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Svn e il Resident Shield di AVG</title>
            <category>Varie</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2010/06/08/svn-e-il-resident-shield-di-avg.aspx</link>
            <description>Negli ultimi periodi è emersa una problematica nell'import o commit di diversi file in repositories svn (soprattutto su grosse quantità).&lt;br /&gt;
Dopo alcune ricerche abbiamo riscontrato la stessa problematica in alcuni utilizzatori di AVG. L'unica soluzione che abbiamo trovato per risolvere la problematica è stata quella di escludere la cartella del repository dal resident shield di AVG e tutto ha ripreso a funzionare (con un discreto aumento di prestazioni).&lt;br /&gt;
&lt;br /&gt;
Riporto qui un paio di link :&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://russtaylor.co.uk/2009/12/error-when-importing-to-subversion-repository-the-requested-operation-cannot-be-performed-on-a-file-with-a-user-mapped-section-open/"&gt;http://russtaylor.co.uk/2009/12/error-when-importing-to-subversion-repository-the-requested-operation-cannot-be-performed-on-a-file-with-a-user-mapped-section-open/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://stackoverflow.com/questions/2182822/how-to-change-from-https-to-svn-protocol-in-subversion-server"&gt;http://stackoverflow.com/questions/2182822/how-to-change-from-https-to-svn-protocol-in-subversion-server&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Ovviamente ogni altra soluzione / consiglio è ben accetto :)&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/98744.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2010/06/08/svn-e-il-resident-shield-di-avg.aspx</guid>
            <pubDate>Tue, 08 Jun 2010 23:04:27 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2010/06/08/svn-e-il-resident-shield-di-avg.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/98744.aspx</wfw:commentRss>
        </item>
        <item>
            <title>svn:externals e referenze</title>
            <category>Varie</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2010/05/12/svnexternals-e-referenze.aspx</link>
            <description>Mentre stavo attuando una risistemazione di alcuni repositories SNV mi sono imbattuto in questo articolo (non proprio "nuovo" lo ammetto &lt;img src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" alt="" /&gt;) che spiega in maniera abbastanza semplice come gestire gli externals nei repositories svn e di come questa può essere una soluzione per le referenze dei progetti:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://arcware.net/using-svn-externals-to-manage-project-references/"&gt;http://arcware.net/using-svn-externals-to-manage-project-references/&lt;/a&gt;&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/98550.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2010/05/12/svnexternals-e-referenze.aspx</guid>
            <pubDate>Wed, 12 May 2010 14:24:04 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2010/05/12/svnexternals-e-referenze.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/98550.aspx</wfw:commentRss>
        </item>
        <item>
            <title>DDD : utilizzo di servizi di dominio all'interno di entità</title>
            <category>DDD</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2010/04/07/ddd-utilizzo-di-servizi-di-dominio-allinterno-di-entita.aspx</link>
            <description>Una delle problematiche frequenti che ho incontrato nella stesura di domain model complessi è l'utilizzo di servizi di dominio all'interno di entità. Tra le varie possibilità ho trovato in rete e sperimentato tre diverse soluzioni:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span style="font-style: italic;"&gt;Service locator statico&lt;/span&gt; : crea non poche problematiche (vedi unit test)..personalmente da evitare &lt;img src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" alt="" /&gt;&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;span style="font-style: italic;"&gt;Risoluzione delle dipendenze delle entità tramite DI&lt;/span&gt; : utilizzando per esempio NHibernate risulta piuttosto semplice risolvere la problematica usando un session interceptor&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;span style="font-style: italic;"&gt;Double dispatch&lt;/span&gt; : risulta di facile implementazione e il codice è immediatamente comprensibile&lt;/li&gt;
&lt;/ul&gt;
Riporto qui due link che parlano dell'ultima casistica:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx"&gt;http://www.lostechies.com/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://thinkbeforecoding.com/post/2009/03/04/How-not-to-inject-services-in-entities"&gt;http://thinkbeforecoding.com/post/2009/03/04/How-not-to-inject-services-in-entities&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Ovviamente queste sono considerazioni personali, ma sarei curioso di capire come tematiche di questo tipo vengono affronate quotidianamente (è molto facile in rete trovare esempi relativi a DDD legati a realtà più o meno semplici, ma casistiche complesse e più "reali" sono molto rare).&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/98322.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2010/04/07/ddd-utilizzo-di-servizi-di-dominio-allinterno-di-entita.aspx</guid>
            <pubDate>Wed, 07 Apr 2010 00:02:47 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2010/04/07/ddd-utilizzo-di-servizi-di-dominio-allinterno-di-entita.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/98322.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Tool per gestire i JS</title>
            <category>ASP.NET</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2010/03/19/tool-per-gestire-i-js.aspx</link>
            <description>Un mio collega mi ha segnalato questo interessante link ad un tool che semplifica la gestione, i caricamenti in parallelo e le dipendenze tra i vari js : &lt;a href="http://labjs.com"&gt;http://labjs.com&lt;br /&gt;
&lt;/a&gt;&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/98237.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2010/03/19/tool-per-gestire-i-js.aspx</guid>
            <pubDate>Fri, 19 Mar 2010 13:28:47 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2010/03/19/tool-per-gestire-i-js.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/98237.aspx</wfw:commentRss>
        </item>
        <item>
            <title>NHibernate : cache di 2° livello e connessione manuale</title>
            <category>NHibernate</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2010/02/08/nhibernate-cache-di-2-livello-e-connessione-manuale.aspx</link>
            <description>Dopo aver superato i piccoli problemi tecnici che mi impedivano di "postare" (grazie al buon &lt;a href="http://blogs.ugidotnet.org/pape"&gt;Andrea&lt;/a&gt;) eccomi nuovamente operativo &lt;img src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" alt="" /&gt;.&lt;br /&gt;
Ecco una casistica che abbiamo affrontato ultimamente all'interno del team di sviluppo, ovvero l'utilizzo di cache di 2° livello e connessione manuale con NHibernate (purtroppo utilizziamo ancora la 1.2.1).&lt;br /&gt;
Come da post del buon &lt;a href="http://ayende.com/Blog/archive/2008/01/24/NHibernate-and-the-second-level-cache-tips.aspx"&gt;Ayende&lt;/a&gt;, nel momento in cui si utilizza una connesione manuale la cache di 2° livello non funziona più correttamente. Dopo le prime ricerche siamo giunti alla soluzione che utilizziamo attualmente, ovvero realizzare un &lt;span style="font-weight: bold;"&gt;ConnectionProvider&lt;/span&gt; personalizzato.&lt;br /&gt;
Nel nostro caso abbiamo bisogno di utilizzare la connessione ad un DB A o un DB B in base a delle particolari condizioni (ovviamente sono strutture identitche) e quindi abbiamo realizzato una soluzione di questo tipo (prendete con le molle lo "pseudocodice") :&lt;br /&gt;
&lt;br /&gt;
&lt;font size="1"&gt;&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;public class CustomConnectionDriver : NHibernate.Connection.ConnectionProvider&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;{&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;    public override IDbConnection GetConnection()&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;    {&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        IDbConnection currentConnection;&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        //Selezione della connessione in base ai criteri&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        if (....)&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        {&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;            currentConnection = ConnessioneA;&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        }&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        else&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        {&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;            currentConnection = ConnessioneB;&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        }&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        currentConnection.Open();&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;        return currentConnection;&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;    }&lt;/span&gt;&lt;br style="font-style: italic; background-color: rgb(255, 255, 255);" /&gt;
&lt;span style="font-style: italic; background-color: rgb(255, 255, 255);"&gt;}&lt;/span&gt;&lt;/font&gt;                 &lt;br /&gt;
&lt;br /&gt;
Successivamente andrà configurato nel file di NHibernate il nostro nuovo connection provider:&lt;br /&gt;
&lt;br /&gt;
&lt;font size="1"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;property name="connection.provider"&amp;gt;CustomConnectionDriver &amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;br /&gt;
&lt;br /&gt;
Ora basta avviare il progetto e provare a verificare il corretto funzionamento della cache di 2° livello.&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/97966.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2010/02/08/nhibernate-cache-di-2-livello-e-connessione-manuale.aspx</guid>
            <pubDate>Mon, 08 Feb 2010 14:56:03 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2010/02/08/nhibernate-cache-di-2-livello-e-connessione-manuale.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/97966.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Custom Web Parts : WebPartChrome</title>
            <category>ASP.NET</category>
            <link>http://blogs.ugidotnet.org/darthdog/archive/2008/02/20/91267.aspx</link>
            <description>&lt;p&gt;Dopo un piccolo periodo di assenza ho deciso di postare alcune parti di codice per la realizzazione di una WebPartChrome custom (anche in seguito alla richiesta da parte di un lettore del blog &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;).&lt;/p&gt;
&lt;p&gt;Nel mio caso ho dovuto realizzare delle webparts con un look&amp;amp;feel completamente custom e questo porta alla necessità di realizzare un WebPartChrome, il quale si occupa del rendering vero e proprio.&lt;/p&gt;
&lt;p&gt;Quindi realizziamo la nostra classe MyWebPartChrome che eredita direttamente da WebPartChrome e andiamo a fare l'override del metodo &lt;font size="2"&gt;&lt;strong&gt;RenderWebPart&lt;/strong&gt; :&lt;/font&gt;&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #eeeeee"&gt;&lt;font size="2"&gt;&lt;font face="Arial" size="1"&gt;public class MyWebPartChrome : WebPartChrome&lt;br /&gt;
{&lt;br /&gt;
   ....&lt;br /&gt;
   public override void RenderWebPart(HtmlTextWriter writer, WebPart webPart)&lt;br /&gt;
   {&lt;br /&gt;
      RenderWebPartHeader(writer, webPart)&lt;br /&gt;
      RenderPartContents(writer, webPart);&lt;br /&gt;
      RenderWebPartFooter(writer, webPart);&lt;br /&gt;
   }&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font style="BACKGROUND-COLOR: #c0c0c0" face="Arial" size="1"&gt;&lt;font style="BACKGROUND-COLOR: #ffffff" size="2"&gt;Dove i tre metodi richiamati all'interno sono due metodi privati che si occupano di renderizzare parti distinte delle mie web parts (header e footer) e il metodo standard della WebPartChrome per la renderizzazione del contenuto. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;Per semplifcare ulteriormente la creazione del mio look&amp;amp;feel ho deciso di utilizzare dei templates, ovvero un file HTML che contiene dei semplici segnaposto dove andare a sostituire le parti necessarie per il corretto funzionamento del framework delle webparts (cosa su tutte l'ID del Title, che come accennavo nell'altro &lt;a href="http://blogs.ugidotnet.org/darthdog/archive/2007/10/04/88726.aspx"&gt;post&lt;/a&gt;, permette il corretto funzionamento del drag&amp;amp;drop). Avremmo quindi un template di questo tipo :&lt;/font&gt;&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #eeeeee"&gt;&lt;font face="Arial"&gt;&lt;font face="Arial" size="1"&gt;&amp;lt;div id="[IDWebPart]" class="miaclass1"&amp;gt;&lt;br /&gt;
    &amp;lt;div id="[IDTitolo]" class="miaclass2"&amp;gt;&lt;br /&gt;
        [Titolo]&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class="miaclass3"&amp;gt;&lt;br /&gt;
        [Verbi]        &lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt; &lt;br /&gt;
    &amp;lt;div class="miaclass4"&amp;gt;&lt;br /&gt;
  &amp;lt;div style="[Visibilita]"&amp;gt;&lt;br /&gt;
   [Contenuto]&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class="miaclass5"&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class="miaclass6"&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;Una volta realizzato il mio template sarà compito del mio CustomChrome (o di altro) andare a leggersi il file direttamente da filesystem (con eventuale verifica di data modifica) o come risorsa incorporata. Questo esempio di template viene spezzato in Header e Footer tramite il segnaposto &lt;strong&gt;[Contenuto], &lt;/strong&gt;che indica dove verrà renderizzato il contenuto della web part vera e propria:&lt;/font&gt;&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #eeeeee"&gt;&lt;font face="Arial"&gt;&lt;font size="1"&gt;....&lt;br /&gt;
webPartTemplate = MyTemplateBuilder.Split(new string[] { "[Contenuto]" }, StringSplitOptions.RemoveEmptyEntries);&lt;br /&gt;
WEBPART_TEMPLATE_HEADER = webPartTemplate[0];&lt;br /&gt;
WEBPART_TEMPLATE_FOOTER = webPartTemplate[1];&lt;br /&gt;
....&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;A questo punto ecco i metodi che renderizzano Header e Footer:&lt;/font&gt;&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #eeeeee"&gt;&lt;font face="Arial"&gt;&lt;font face="Arial" size="1"&gt;&lt;font face="Arial"&gt;private void RenderWebPartHeader(HtmlTextWriter writer, WebPart webPart)&lt;br /&gt;
{&lt;br /&gt;
   writer.Write(WEBPART_TEMPLATE_HEADER&lt;br /&gt;
      .Replace("[IDWebPart]", GetWebPartChromeClientID(webPart))&lt;br /&gt;
      .Replace("[Icona]", webPart.ResolveUrl(webPart.TitleIconImageUrl))&lt;br /&gt;
      .Replace("[IDTitolo]", GetWebPartTitleClientID(webPart))&lt;br /&gt;
      .Replace("[Titolo]", webPart.Title)&lt;br /&gt;
      .Replace("[Verbi]", RenderVerbs(webPart))&lt;br /&gt;
      .Replace("[Visibilita]", (webPart.ChromeState == PartChromeState.Minimized)?"display:none;":"")&lt;br /&gt;
   );&lt;br /&gt;
}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #eeeeee"&gt;&lt;font face="Arial"&gt;&lt;font face="Arial" size="1"&gt;private void RenderWebPartFooter(HtmlTextWriter writer, WebPart webPart)&lt;br /&gt;
{&lt;br /&gt;
   writer.Write(WEBPART_TEMPLATE_FOOTER);&lt;br /&gt;
}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Spero che questo piccolo post possa essere utile per la realizzazione di un Chrome completamente custom, operazione che a mio parere risultà un pò più macchinosa di quanto mi aspettassi, soprattutto data la fatica nella ricerca di materiale e di esempi &lt;em&gt;funzionanti&lt;/em&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;PS: ovviamente questo è un esempio scritto di getto e con un pò di taglia/incolla dal progetto che ho realizzato, quindi prendetelo giusto come piccola traccia &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/wink_smile.gif" /&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/darthdog/aggbug/91267.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Andrea Canegrati</dc:creator>
            <guid>http://blogs.ugidotnet.org/darthdog/archive/2008/02/20/91267.aspx</guid>
            <pubDate>Wed, 20 Feb 2008 14:05:50 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/darthdog/archive/2008/02/20/91267.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/darthdog/comments/commentRss/91267.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>