<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>makka</title>
        <link>http://blogs.ugidotnet.org/makka/Default.aspx</link>
        <description>Nessuna domanda è stupida, a volte lo sono le risposte</description>
        <language>it-IT</language>
        <copyright>Claudio Maccari</copyright>
        <managingEditor>claudio.maccari@gmail.com</managingEditor>
        <generator>Subtext Version 1.9.5.176</generator>
        <image>
            <title>makka</title>
            <url>http://blogs.ugidotnet.org/images/RSS2Image.gif</url>
            <link>http://blogs.ugidotnet.org/makka/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Gli {eroi} del semaforo</title>
            <link>http://blogs.ugidotnet.org/makka/archive/2008/03/07/gli-eroi-del-semaforo.aspx</link>
            <description>&lt;p&gt;Per chi è stato in questi giorni al lancio dei nuovi prodotti Microsoft sicuramente avrà già visto questi due strani tizi(da sx &lt;a href="http://blogs.ugidotnet.org/BlogEma/Default.aspx"&gt;Emanuele&lt;/a&gt; ed &lt;a href="http://community.ugiss.org/blogs/abenedetti/"&gt;Andrea&lt;/a&gt;). Se ancora non sapete a cosa serve il semaforo non vi resta che leggere &lt;a href="http://blogs.ugidotnet.org/makka/archive/2007/10/26/89223.aspx"&gt;qui&lt;/a&gt;.&lt;/p&gt; &lt;p&gt; &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/makka/WindowsLiveWriter/Glieroidelsemaforo_AF75/semaforo_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="484" alt="semaforo" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/makka/WindowsLiveWriter/Glieroidelsemaforo_AF75/semaforo_thumb.jpg" width="482" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/91562.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2008/03/07/gli-eroi-del-semaforo.aspx</guid>
            <pubDate>Fri, 07 Mar 2008 11:31:55 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2008/03/07/gli-eroi-del-semaforo.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/91562.aspx</wfw:commentRss>
        </item>
        <item>
            <title>IronRuby news</title>
            <link>http://blogs.ugidotnet.org/makka/archive/2008/02/21/ironruby-news.aspx</link>
            <description>&lt;p&gt;Da un’annuncio di &lt;a href="http://members.microsoft.com/careers/search/details.aspx?JobID=7C2E33E8-5A9C-44F3-A1CE-DA2D66DC3C8B"&gt;lavoro&lt;/a&gt; MS segnalo 2 punti interessanti relativi al progetto IronRuby:  &lt;/p&gt;&lt;p&gt;· Our goal this year is to get Ruby on Rails working in IronRuby  &lt;/p&gt;&lt;p&gt;· We also want to provide IronRuby support in the Visual Studio IDE&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c6cfdfe1-7112-4cc2-adc3-d44345e9992b" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Ruby%20on%20Rails" rel="tag"&gt;Ruby on Rails&lt;/a&gt;, &lt;a href="http://technorati.com/tags/IronRuby" rel="tag"&gt;IronRuby&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Ruby" rel="tag"&gt;Ruby&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/91290.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2008/02/21/ironruby-news.aspx</guid>
            <pubDate>Thu, 21 Feb 2008 09:38:55 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2008/02/21/ironruby-news.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/91290.aspx</wfw:commentRss>
        </item>
        <item>
            <title>UgiAlt.net (mini)conference - 23 Febbraio 2008</title>
            <category>.NET</category>
            <category>agile</category>
            <category>alt.net</category>
            <link>http://blogs.ugidotnet.org/makka/archive/2008/01/12/ugialt.net-miniconference---23-febbraio-2008.aspx</link>
            <description>&lt;p&gt;Come &lt;a href="http://blogs.ugidotnet.org/BlogEma/archive/2007/12/17/ugialt.net-miniconference.aspx"&gt;scritto&lt;/a&gt; da &lt;a href="http://blogs.ugidotnet.org/BlogEma/"&gt;Ema&lt;/a&gt; qualche tempo fa, come &lt;a href="http://www.ugialt.net"&gt;ugialt.net&lt;/a&gt; stiamo organizzando una giornata di conferenza. Dopo il sondaggio fatto sulla lista è emerso che il giorno preferito è 23 Febbraio 2008. &lt;img src="http://ugialt.net/GetFile.aspx?File=ugialtnetconf.jpg" /&gt;&lt;/p&gt; &lt;p&gt;La conferenza si svolgerà presso la sede di &lt;a href="http://www.absistemi.it/"&gt;ABSistemi&lt;/a&gt; che gentilmente ci supporta in questa iniziativa. Abbiamo già alcune proposte che a breve metteremo ai voti per capire quali siano più interessanti e quindi meritano essere i primi temi di discussione. La partecipazione è completamente gratuita! Il formato delle sessioni sarà di tipo open space, quindi chi propone gli argomenti non ha il ruolo dello "speaker classico" ma ha lo scopo di dare avvio alla discussione con codice, qualche slide o semplicemente introducendo l'argomento e di lasciare poi che le cose vadano. In pratica sarà una tavola rotonda sui temi scelti in cui ognuno può prendere la parola (o la tastiera) e proporre soluzioni o sottoporre nuove domande.&lt;/p&gt; &lt;p&gt;Maggiori informazioni sul &lt;a href="http://ugialt.net/Meetings.ashx"&gt;sito&lt;/a&gt; e sulla &lt;a href="http://tech.groups.yahoo.com/group/ugialtnet/"&gt;mailing list&lt;/a&gt;. &lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f6ea5b9b-ca96-4ebe-b2f0-8f456e5222c3" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/ugiatl.net" rel="tag"&gt;ugiatl.net&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/90665.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2008/01/12/ugialt.net-miniconference---23-febbraio-2008.aspx</guid>
            <pubDate>Sat, 12 Jan 2008 13:46:48 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2008/01/12/ugialt.net-miniconference---23-febbraio-2008.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/90665.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Callbacks hook come RubyOnRails in C#</title>
            <category>.NET</category>
            <link>http://blogs.ugidotnet.org/makka/archive/2008/01/05/callbacks-hook-come-rubyonrails-in-c.aspx</link>
            <description>&lt;p&gt;In questi giorni di calma apparente mi sto guardando un po' di &lt;a href="http://www.rubyonrails.org/"&gt;RubyOnRails&lt;/a&gt;. In questo framework ho trovato cose interessanti. Una tra le tante è la possibilità di definire nel Model dei metodi in modo tale che vengano invocati prima e dopo una determinata azione. Es. è possibile indicare un metodo come azione &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001297"&gt;before_save&lt;/a&gt;  in modo che venga eseguito prima del metodo save.  &lt;br /&gt;Sono presenti parecchie possibilità tra cui:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001300"&gt;after_create&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001310"&gt;after_destroy&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001298"&gt;after_save&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001302"&gt;after_update&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001304"&gt;after_validation&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001306"&gt;after_validation_on_create&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001308"&gt;after_validation_on_update&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001299"&gt;before_create&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001309"&gt;before_destroy&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001297"&gt;before_save&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001301"&gt;before_update&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001303"&gt;before_validation&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001305"&gt;before_validation_on_create&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001307"&gt;before_validation_on_update&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Maggiori info a riguardo le trovate &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html"&gt;qui&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Ora mi sono chiesto come è possibile avere una funzionalità simile in C#. Ho aperto VisualStudio è sono giusto a questa soluzione. &lt;em&gt;&lt;strong&gt;E' solo una prima bozza, sicuramente si può fare di meglio! &lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;Partiamo per esempio da un piccolo pezzo di codice che salva un oggetto Task così:&lt;/p&gt; &lt;div&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; Task task = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Task(1, DateTime.Today, &lt;span style="color: #006080"&gt;"Demo task"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; IModel model = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; TaskModel();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; model.Save(task);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;ora quello che vorrei ottenere è la possibilità di eseguire un metodo prima ed uno metodo dopo il Save. La prima soluzione sfrutta una mia classe Hook in cui ho definito un metodo che accetta come parametri il metodo da invocare, il parametro per questo metodo e successivamente 2 delegate ai metodi che voglio eseguire come &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001297"&gt;before_save&lt;/a&gt; e &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html#M001298"&gt;after_save&lt;/a&gt;:&lt;/p&gt;
&lt;div&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Hook&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Action&amp;lt;A&amp;gt;(A a);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;  &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&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;void&lt;/span&gt; Do&amp;lt;A&amp;gt;(Action&amp;lt;A&amp;gt; action, A a, Action beforeAction, Action afterAction)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         beforeAction();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         action(a);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         afterAction();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Poi viene usata così:&lt;/p&gt;
&lt;div&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; Task task = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Task(1, DateTime.Today, &lt;span style="color: #006080"&gt;"Demo task"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; IModel model = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; TaskModel();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; Hook.Do(model.Save, task, model.ActionsBeforeSave, model.ActionsAfterSave);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Partendo da questa prima soluzione ho cercato di sfruttare l'uso deglil attributi in modo tale da rendere il mio codice più semplice e leggibile. La seconda soluzione sfrutta quindi oltre ai delegate anche gli attributi da me creati Before e After con cui viene decorato il metodo Save&lt;/p&gt;
&lt;div&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; TaskModel&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;readonly&lt;/span&gt; Storage _storage;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; TaskModel()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         _storage = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Storage();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     [Before(&lt;span style="color: #006080"&gt;"ActionsBeforeSave"&lt;/span&gt;), After(&lt;span style="color: #006080"&gt;"ActionsAfterSave"&lt;/span&gt;)]&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Save(Task task)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         _storage.SaveOrUpdate(task);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ActionsBeforeSave()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         &lt;span style="color: #008000"&gt;//_storage.Connect();&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         Console.WriteLine(&lt;span style="color: #006080"&gt;"Action before save...."&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ActionsAfterSave()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         &lt;span style="color: #008000"&gt;//_storage.Disconnect();&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;         Console.WriteLine(&lt;span style="color: #006080"&gt;"Action after save...."&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; Poi sulla classe Hook ho aggiunto un overload di Do che sfrutta l'uso dei gli attributi&lt;/p&gt;
&lt;div&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Hook&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Action&amp;lt;A&amp;gt;(A a);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;  &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&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;void&lt;/span&gt; Do&amp;lt;A&amp;gt;(Action&amp;lt;A&amp;gt; action, A a)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         Invoke(action, &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(BeforeAttribute));&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         action(a);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         Invoke(action, &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(AfterAttribute));&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;  &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Invoke(Delegate action, Type type)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[] attributes = action.Method.GetCustomAttributes(type, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         ActionAttribute attribute = (ActionAttribute)attributes[0];&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         MethodInfo method = action.Target.GetType().GetMethod(attribute.Action);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;         method.Invoke(action.Target, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;che poi nel viene usata così:&lt;/p&gt;
&lt;div&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; Task task = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Task(1, DateTime.Today, &lt;span style="color: #006080"&gt;"Demo task"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; IModel model = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; TaskModel();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; Hook.Do(model.Save, task);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Per concludere l'utilizzo del metodo Do della classe Hook è un pò primitivo, andrebbe migliorato in modo che si possa invocare direttamente il metodo Save del model (come l'esempio all'iniziale) senza dove esplicitamente usare Hook.Do(...) . Non dovrebbe essere difficile, magari usando un &lt;a href="http://c2.com/cgi/wiki?DecoratorPattern"&gt;Decorator&lt;/a&gt;, potrer migliorare anche questo aspetto, ma questo è un'altro post...&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9c9680ff-0b60-4661-b11b-918de2dcc03f" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/C#" rel="tag"&gt;C#&lt;/a&gt;, &lt;a href="http://technorati.com/tags/callbacks" rel="tag"&gt;callbacks&lt;/a&gt;, &lt;a href="http://technorati.com/tags/hooks" rel="tag"&gt;hooks&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Ruby%20on%20Rails" rel="tag"&gt;Ruby on Rails&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/90568.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2008/01/05/callbacks-hook-come-rubyonrails-in-c.aspx</guid>
            <pubDate>Sat, 05 Jan 2008 14:45:29 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2008/01/05/callbacks-hook-come-rubyonrails-in-c.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/90568.aspx</wfw:commentRss>
        </item>
        <item>
            <title>L'importanza delle persone nello sviluppo software</title>
            <category>agile</category>
            <link>http://blogs.ugidotnet.org/makka/archive/2007/12/11/limportanza-delle-persone-nello-sviluppo-software.aspx</link>
            <description>&lt;p&gt;Stasera mentre leggevo un post sulla &lt;a href="http://it.groups.yahoo.com/group/extremeprogramming-it/"&gt;mailing-list extremeprogramming-it&lt;/a&gt; ho letto un passaggio che condivido pienamente e che quindi mi permetto di riportare qui:&lt;/p&gt; &lt;p&gt;&lt;em&gt;.... per una società che si occupa di sviluppo software l'attività con il maggior ritorno economico è la selezione del personale e la crescita delle persone al suo interno, quindi su questo dovrebbero aversi i maggiori investimenti e a questo dovrebbero essere assegnate le persone più affidabili.&lt;br /&gt;Là dove una fabbrica di automobili da per scontato un grosso investimento per acquisire la tecnologia e il macchinario necessari, una software-house deve dare per scontato un grosso sforzo ed esborso&lt;br /&gt;nell'acquisizione delle persone.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;In futuro sarà la prima frase che suggerirò a chi mi chiede consiglio su come cercare un nuovo membro per il proprio team di sviluppo.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:87c84b43-d33f-40d6-a1c1-9fea2e9d58da" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/agile" rel="tag"&gt;agile&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/90206.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2007/12/11/limportanza-delle-persone-nello-sviluppo-software.aspx</guid>
            <pubDate>Mon, 10 Dec 2007 23:55:39 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2007/12/11/limportanza-delle-persone-nello-sviluppo-software.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/90206.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Reflection &amp;amp; MbUnit</title>
            <category>.NET</category>
            <category>agile</category>
            <category>alt.net</category>
            <link>http://blogs.ugidotnet.org/makka/archive/2007/12/09/reflection-amp-mbunit.aspx</link>
            <description>&lt;p&gt;Oggi, facendo alcune prove suggerite da &lt;a href="http://blogs.ugidotnet.org/AntonioGanci/archive/2007/12/07/90154.aspx"&gt;questo&lt;/a&gt; post di &lt;a href="http://blogs.ugidotnet.org/AntonioGanci/"&gt;Antonio&lt;/a&gt;, ho notato che nell'assembly MbUnit.Framework.2.0 è disponibile la classe Reflector che serve per controllare lo stato di un oggetto tramite reflection in maniera molto semplice.&lt;/p&gt; &lt;p&gt;Per esempio:&lt;/p&gt; &lt;p&gt;[Test]&lt;br /&gt;public void Ctor_Always_SetFieldName()&lt;br /&gt;{&lt;br /&gt;    Foo foo = new Foo("claudio");&lt;br /&gt;    Assert.AreEqual("claudio", Reflector.GetField(foo, "_name"));&lt;br /&gt;} &lt;/p&gt;&lt;p&gt;serve per controllare che il costruttore imposti correttamente il valore della variabile di classe che si chiama _name. Ovvero che Foo sia così: &lt;/p&gt;&lt;p&gt;public class Foo&lt;br /&gt;{&lt;br /&gt;    private readonly string _name;  &lt;/p&gt;&lt;p&gt;    public Foo(string name)&lt;br /&gt;    {&lt;br /&gt;        _name = name;&lt;br /&gt;    }&lt;br /&gt;} &lt;/p&gt;&lt;p&gt;Anche se generalmente un test non controlla lo stato interno di un'oggetto ci sono scenari in cui una funzionalità di MbUnit può tornare sicuramente utile.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:783893b2-d6c5-4285-bd6d-f71ecd4719cc" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/TDD" rel="tag"&gt;TDD&lt;/a&gt;, &lt;a href="http://technorati.com/tags/test%20driven%20development" rel="tag"&gt;test driven development&lt;/a&gt;, &lt;a href="http://technorati.com/tags/MbUnit" rel="tag"&gt;MbUnit&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/90181.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2007/12/09/reflection-amp-mbunit.aspx</guid>
            <pubDate>Sun, 09 Dec 2007 13:26:59 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2007/12/09/reflection-amp-mbunit.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/90181.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Nomi per i metodi di test</title>
            <link>http://blogs.ugidotnet.org/makka/archive/2007/12/09/nomi-per-i-metodi-di-test.aspx</link>
            <description>&lt;p&gt;Solitamente quando scrivo un metodo di test cerco di dargli un nome che sia riassuntivo per il codice che sto andando a testare di modo che un domani quando ci ritornerò per qualsiasi motivo mi basterà leggerne il nome per capire che test viene eseguito al suo interno. Guardando in giro vedo che sul web più o meno questo è quello che fanno tutti gli "adepti" dello unit-test.&lt;/p&gt; &lt;p&gt;Quest'anno al TechEd, &lt;a href="http://weblogs.asp.net/rosherove/"&gt;Roy Osherove&lt;/a&gt; ha suggerito questo pattern per dare un nome ai metodi di test:&lt;/p&gt; &lt;p&gt;        &lt;strong&gt;&lt;em&gt;NomeMetodo_Condizione_Comportamento&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;visto che mi sembrava cosa buone e giusta, ho aggiornato il mio template di &lt;a href="http://www.jetbrains.com/resharper/"&gt;Resharper&lt;/a&gt; "test" così:  &lt;/p&gt;&lt;p&gt;[Test]&lt;br /&gt;public void $MethodName$_$Condition$_$Behaviour$() &lt;br /&gt;{ &lt;br /&gt;    $END$&lt;br /&gt;}&lt;/p&gt; &lt;p&gt;che applicato ad un caso reale diventa: la proprietà DataAvailable, se non ci sono files, deve essere falsa.&lt;/p&gt; &lt;p&gt;[Test]&lt;br /&gt;public void DataAvailable_NoFilesAvailable_IsFalse()&lt;br /&gt;{&lt;br /&gt;    using (_mock.Record())&lt;br /&gt;    {&lt;br /&gt;        //some expectations here&lt;br /&gt;    }&lt;br /&gt;    using (_mock.Playback())&lt;br /&gt;    {&lt;br /&gt;        IModel model = new Model(_fileSystem);&lt;br /&gt;        Assert.IsFalse(model.DataAvailable);&lt;br /&gt;    }&lt;br /&gt;}  &lt;/p&gt;&lt;p&gt;Ho notato che anche alcuni colleghi hanno deciso di utilizzare lo stesso template. Spero che il suggerimento sia gradito anche ad altri.&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/90180.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2007/12/09/nomi-per-i-metodi-di-test.aspx</guid>
            <pubDate>Sun, 09 Dec 2007 13:04:12 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2007/12/09/nomi-per-i-metodi-di-test.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/90180.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Chat UGIALT.NET: 10 Dicembre 2007 ore 21.00</title>
            <category>.NET</category>
            <category>agile</category>
            <category>alt.net</category>
            <link>http://blogs.ugidotnet.org/makka/archive/2007/12/03/chat-ugialt.net-10-dicembre-2007-ore-21.00.aspx</link>
            <description>&lt;p&gt;&lt;img src="http://ugialt.net/GetFile.aspx?File=logo.png" align="left" /&gt;Dopo gli &lt;a href="http://blogs.ugidotnet.org/BlogEma/archive/2006/12/20/60837.aspx"&gt;esperimenti&lt;/a&gt; realizzati l'inverno scorso e le positive discussioni che hanno seguito &lt;a href="http://it.wikipedia.org/wiki/Open_Space_Technology"&gt;l'open space&lt;/a&gt; di quest'anno &lt;a href="http://www.agileday.it/"&gt;all'agileday&lt;/a&gt;  abbiamo deciso di dare il via ad una serie di chat "tecnologiche".&lt;/p&gt; &lt;p&gt;Dal sondaggio effettuato sulla &lt;a href="http://tech.groups.yahoo.com/group/ugialtnet/"&gt;lista&lt;/a&gt; risulta che la data preferita è 10 Dicembre. Quindi è confermato che ci troviamo online su GTalk alle 21.00 .&lt;/p&gt; &lt;p&gt;I temi che tratteremo saranno: &lt;/p&gt; &lt;ul&gt; &lt;li&gt;cos'è &lt;a href="http://ugialt.net/"&gt;ALT.NET&lt;/a&gt;&lt;/li&gt; &lt;li&gt;quali &lt;a href="http://ugialt.net/tools.ashx"&gt;strumenti&lt;/a&gt; e quali &lt;a href="http://ugialt.net/agile.ashx"&gt;metodologie&lt;/a&gt; usiamo&lt;/li&gt; &lt;li&gt;progetti del gruppo? (incontri veri a gennaio e progetto open source)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;L'iniziativa è aperta a tutti, e tutti potranno parlare ed esprimere opinioni, consigli, esperienze, portare amici, ecc... quindi se qualcuno ha voglia di partecipare non deve far altro che contattarmi tramite il blog inviandomi il suo indirizzo GTalk.&lt;/p&gt; &lt;p&gt;Vi aspettiamo!&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:81902e35-f7a9-4738-8323-b4b6f68d9d18" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/ugiatl.net" rel="tag"&gt;ugiatl.net&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/90082.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2007/12/03/chat-ugialt.net-10-dicembre-2007-ore-21.00.aspx</guid>
            <pubDate>Mon, 03 Dec 2007 21:10:46 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2007/12/03/chat-ugialt.net-10-dicembre-2007-ore-21.00.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/90082.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Roy Osherove: cantante al TechEd 2007</title>
            <category>.NET</category>
            <link>http://blogs.ugidotnet.org/makka/archive/2007/11/26/roy-osherove-cantante-al-teched-2007.aspx</link>
            <description>&lt;div&gt;Sicuramente come cantante non avrà mai successo ma come speaker bisogna riconoscere che ci sa proprio fare!&lt;/div&gt;
&lt;embed width="425" height="355" src="http://www.youtube.com/v/XV5fViOoV_8&amp;amp;rel=1" type="application/x-shockwave-flash" wmode="transparent"&gt;&lt;/embed&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:bc29946b-4045-41bb-9b81-8bfc36b5e285" contenteditable="false" style="margin: 0px; padding: 0px; display: inline;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Tech%20Ed" rel="tag"&gt;Tech Ed&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/89953.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2007/11/26/roy-osherove-cantante-al-teched-2007.aspx</guid>
            <pubDate>Mon, 26 Nov 2007 20:22:55 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2007/11/26/roy-osherove-cantante-al-teched-2007.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/89953.aspx</wfw:commentRss>
        </item>
        <item>
            <title>User stories applied [cap.7] : altri suggerimenti</title>
            <category>agile</category>
            <link>http://blogs.ugidotnet.org/makka/archive/2007/11/19/user-stories-applied-cap.7--altri-suggerimenti.aspx</link>
            <description>&lt;p&gt;Di seguito alcune linee guida addizionali per scrivere buone storie:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Per identificare le storie considerare lo scopo di ogni ruolo utente del sistema.&lt;/li&gt;
    &lt;li&gt;Quando si divide una storia cercare di avere storie che attraversano tutti gli strati dell'applicazione.&lt;/li&gt;
    &lt;li&gt;Scrivere storie di una dimensione tale per cui lo sviluppatore, dopo averla conclusa, si senta giustificato nel prendere un caffè.&lt;/li&gt;
    &lt;li&gt;Completare le storie con ogni tipo di documentazione ci sembra utile per comprendere meglio il dominio applicativo.&lt;/li&gt;
    &lt;li&gt;Creare storie anche per le costanti applicative, esporle in modo che siano sempre ben visibili e scrivere dei test che che ne controllano inviolabilità.&lt;/li&gt;
    &lt;li&gt;Scrivere storie piccole per le funzionalità che il team implementerà a breve e storie "di alto livello" per le funzionalità che verrano in futuro.&lt;/li&gt;
    &lt;li&gt;Evitare di inserire riferimenti all'interfaccia utente nelle storie.&lt;/li&gt;
    &lt;li&gt;Inserire un riferimento al ruolo utente all'interno di una storia se ne aumenta la chiarezza.&lt;/li&gt;
    &lt;li&gt;Scrivere storie per  singoli utenti.&lt;/li&gt;
    &lt;li&gt;Far scrivere le storie al cliente invece che agli sviluppatori&lt;/li&gt;
    &lt;li&gt;Scrivere storie corte: il loro scopo e ricordare la conversazione in cui abbiamo parlato dei dettagli.&lt;/li&gt;
    &lt;li&gt;Non numerare le storie.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline;" contenteditable="false" id="0767317B-992E-4b12-91E0-4F059A8CECA8:e023d7d0-cab6-46a3-a1f2-0abdf9a60577" class="wlWriterSmartContent"&gt;Technorati tags: &lt;a rel="tag" href="http://technorati.com/tags/user%20stories"&gt;user stories&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/agile"&gt;agile&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/makka/aggbug/89803.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Claudio Maccari</dc:creator>
            <guid>http://blogs.ugidotnet.org/makka/archive/2007/11/19/user-stories-applied-cap.7--altri-suggerimenti.aspx</guid>
            <pubDate>Mon, 19 Nov 2007 20:13:11 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/makka/archive/2007/11/19/user-stories-applied-cap.7--altri-suggerimenti.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/makka/comments/commentRss/89803.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>