<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Eran Nachum's Blog</title>
    <link>http://www.eranachum.com/</link>
    <description>www.eranachum.com - Implementing &amp; executing my thoughts...</description>
    <language>en-us</language>
    <copyright>Eran Nachum</copyright>
    <lastBuildDate>Wed, 12 Dec 2007 23:02:19 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.8.5223.2</generator>
    <managingEditor>eranachum@hotmail.com</managingEditor>
    <webMaster>eranachum@hotmail.com</webMaster>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=089badbf-c01c-4363-a236-617ccf85ce3b</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,089badbf-c01c-4363-a236-617ccf85ce3b.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      The reason I published this post is because I didn't find any result when googling
      the error description and solved it myself at last.
   </p>
        <p>
      If you're asp.net developers you probably know the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx" target="_blank">ObjectDataSource</a> object,
      which represents a business object that provides data to data-bound controls in multi-tier
      Web application architectures.
   </p>
        <p>
      I like this object, most of the time this object can solve you all the annoying steps
      logic of calling the BL/DAL object in order to retrieve the data and populate the
      wanted presentation control.
   </p>
        <p>
      On one of my working on website's pages (which is quite complex one that knows to
      list data from several sources and procedures), I am using such of object as a data
      source in the main GridView that renders a list of records. In order to interact with
      each different select method I had to set every time the SelectMethod property and
      it's specific parameters in the code-behind. Until now everything is just fine...
   </p>
        <p>
      It seems that working this way affects the other postback events on the page, (because
      after event postback, the OnInit and OnLoad events are being called first and just
      after it the event handler itself is being called), here my page was crashed and gave
      this error message: "<i>The Select operation is not supported by ObjectDataSource
      '&lt;objectdatasource_id&gt;' unless the SelectMethod is specified.</i>"
   </p>
        <p>
      This error caused because the page expected the SelectMethod property to be initialized
      between the OnInit and OnLoad methods and just after it the rest of the events.
   </p>
        <p>
      The resolution is quite easy in this case; 
   </p>
        <p>
      First, you need to remove the ObjectDataSourceID property definition from the control
      properties' definitions layout in the control source and set the DataSource for the
      control to the desired one in the OnInit method. After it, in the OnPreRender method
      call the control's DataBind method in order to bind the data source. This last action
      will allow to any event to happen and just after it to set up the Control (the GridView
      in my case) with data.
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">protected</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">override</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> OnInit(EventArgs
      e)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   base</span>.OnInit(e);<br />
         MyGridView.DataSource <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> MyObjectDataSource;<br />
      }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">protected</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">override</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> OnPreRender(EventArgs
      e)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   base</span>.OnPreRender(e);<br />
         MyGridView.DataBind();<br />
      }</span>
        </p>
        <p>
      I hope it'll help anyone...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=089badbf-c01c-4363-a236-617ccf85ce3b" />
      </body>
      <title>Manually Set ObjectDataSource.SelectMethod Property BUG</title>
      <guid>http://www.eranachum.com/PermaLink,guid,089badbf-c01c-4363-a236-617ccf85ce3b.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,089badbf-c01c-4363-a236-617ccf85ce3b.aspx</link>
      <pubDate>Wed, 12 Dec 2007 23:02:19 GMT</pubDate>
      <description>&lt;p&gt;
   The reason I published this post is because I didn't find any result when googling
   the error description and solved it myself at last.
&lt;/p&gt;
&lt;p&gt;
   If you're asp.net developers you probably know the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx" target=_blank&gt;ObjectDataSource&lt;/a&gt; object,
   which represents a business object that provides data to data-bound controls in multi-tier
   Web application architectures.
&lt;/p&gt;
&lt;p&gt;
   I like this object, most of the time this object can solve you all the annoying steps
   logic of calling the BL/DAL object in order to retrieve the data and populate the
   wanted presentation control.
&lt;/p&gt;
&lt;p&gt;
   On one of my working on website's pages (which is quite complex one that knows to
   list data from several sources and procedures), I am using such of object as a data
   source in the main GridView that renders a list of records. In order to interact with
   each different select method I had to set every time the SelectMethod property and
   it's specific parameters in the code-behind. Until now everything is just fine...
&lt;/p&gt;
&lt;p&gt;
   It seems that working this way affects the other postback events on the page, (because
   after event postback, the OnInit and OnLoad events are being called first and just
   after it the event handler itself is being called), here my page was crashed and gave
   this error message: "&lt;i&gt;The Select operation is not supported by ObjectDataSource
   '&amp;lt;objectdatasource_id&amp;gt;' unless the SelectMethod is specified.&lt;/i&gt;"
&lt;/p&gt;
&lt;p&gt;
   This error caused because the page expected the SelectMethod property to be initialized
   between the OnInit and OnLoad methods and just after it the rest of the events.
&lt;/p&gt;
&lt;p&gt;
   The resolution is quite easy in this case; 
&lt;/p&gt;
&lt;p&gt;
   First, you need to remove the ObjectDataSourceID property definition from the control
   properties' definitions layout in the control source and set the DataSource for the
   control to the desired one in the OnInit method. After it, in the OnPreRender method
   call the control's DataBind method in order to bind the data source. This last action
   will allow to any event to happen and just after it to set up the Control (the GridView
   in my case) with data.
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;protected&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;override&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; OnInit(EventArgs
   e)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;base&lt;/span&gt;.OnInit(e);&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;MyGridView.DataSource &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; MyObjectDataSource;&lt;br&gt;
   }&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;protected&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;override&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; OnPreRender(EventArgs
   e)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;base&lt;/span&gt;.OnPreRender(e);&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;MyGridView.DataBind();&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   I hope it'll help anyone...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=089badbf-c01c-4363-a236-617ccf85ce3b" /&gt;</description>
      <category>.NET 2005;ASP.NET;Bugs;C#</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=36f9e516-2473-4cc8-8901-052f07408d07</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,36f9e516-2473-4cc8-8901-052f07408d07.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      As I posted in the last post, I didn't have much time to update my blog last month
      (even most of this month), so I hope I could catch up these days and post some more
      about the on going issues that comes up.
   </p>
        <p>
      Last month, a gut named <strong>Roni Schuetz</strong> send me an email regarding my
      post about <em>Maintaining Data over Multi-Servers (Load Balancing on Web Farm) </em>(direct
      link <a href="http://www.eranachum.com/PermaLink,guid,e62a855a-3633-41f7-842f-a3e9d5f4d5dd.aspx">here</a>).<br />
      Roni is the creator of a project named, Shared Cache which supplies high-performance,
      distributed memory object caching system, generic in nature, but intended to speeding
      up dynamic web and / or win applications by alleviating database load. He suggested
      me to use his project regarding maintaining cached data between multiple servers and
      I acceded testing it.
   </p>
        <p>
      By Roni's documentation and project usage explanations the project is friendly
      usable and for a free-to-use-software I think it is highly recomended using it (or
      at least testing it).
   </p>
        <p>
      Unfortunatly (or not), my company (<a href="http://www.idtglobal.com/" target="_blank">IDT
      Global</a>) has purchased (an expensive and also a great one) tool called <a href="http://www.scaleoutsoftware.com/" target="_blank">ScaleOut
      SessionState</a> In order to maintain session data over multiplae servers.
   </p>
        <p>
      So, if you have an answer regarding this issue or just want to read about it, you
      can try Roni's indeXus.Net Shared Cache <a href="http://www.codeplex.com/SharedCache" target="_blank">here</a>.<br /></p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=36f9e516-2473-4cc8-8901-052f07408d07" />
      </body>
      <title>indeXus.Net Shared Cache By Roni Schuetz </title>
      <guid>http://www.eranachum.com/PermaLink,guid,36f9e516-2473-4cc8-8901-052f07408d07.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,36f9e516-2473-4cc8-8901-052f07408d07.aspx</link>
      <pubDate>Mon, 24 Sep 2007 08:15:21 GMT</pubDate>
      <description>&lt;p&gt;
   As I posted in the last post, I didn't have much time to update my blog last month
   (even most of this month), so I hope I could catch up these days and post some more
   about the on going issues that comes up.
&lt;/p&gt;
&lt;p&gt;
   Last month, a gut named &lt;strong&gt;Roni Schuetz&lt;/strong&gt; send me an email regarding my
   post about&amp;nbsp;&lt;em&gt;Maintaining Data over Multi-Servers (Load Balancing on Web Farm) &lt;/em&gt;(direct
   link &lt;a href="http://www.eranachum.com/PermaLink,guid,e62a855a-3633-41f7-842f-a3e9d5f4d5dd.aspx"&gt;here&lt;/a&gt;).&lt;br&gt;
   Roni is the creator of a project named, Shared Cache which supplies high-performance,
   distributed memory object caching system, generic in nature, but intended to speeding
   up dynamic web and / or win applications by alleviating database load. He suggested
   me to use his project regarding maintaining cached data between multiple servers and
   I acceded testing it.
&lt;/p&gt;
&lt;p&gt;
   By Roni's documentation and project usage explanations&amp;nbsp;the project is friendly
   usable and for a free-to-use-software I think it is highly recomended&amp;nbsp;using it&amp;nbsp;(or
   at least testing it).
&lt;/p&gt;
&lt;p&gt;
   Unfortunatly (or not), my company (&lt;a href="http://www.idtglobal.com/" target=_blank&gt;IDT
   Global&lt;/a&gt;) has purchased (an expensive and also a great one) tool called &lt;a href="http://www.scaleoutsoftware.com/" target=_blank&gt;ScaleOut
   SessionState&lt;/a&gt;&amp;nbsp;In order to maintain session data over multiplae servers.
&lt;/p&gt;
&lt;p&gt;
   So, if you have an answer regarding this issue or just want to read about it, you
   can try Roni's indeXus.Net Shared Cache &lt;a href="http://www.codeplex.com/SharedCache" target=_blank&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&gt;&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=36f9e516-2473-4cc8-8901-052f07408d07" /&gt;</description>
      <category>.NET 2005;ASP.NET;System</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=532c3302-dde3-4abd-a652-1864b13cf8b4</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,532c3302-dde3-4abd-a652-1864b13cf8b4.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I am working against 3rd level party assembly in my current web application. I need
      to send US address information to this assembly and to retrieve an answer whether
      this address is exist or not. This assembly requires validation against X.509 certificate
      (to ensure that only permited client could use the 3rd level's services), which is
      installed on the server that runs the application (in dev environment this is my local
      PC). 
      <br />
      More details about it <a href="http://www.codeproject.com/useritems/X509Certificate.asp" target="_blank">here</a>.
   </p>
        <p>
          <strong>The problem:</strong> In order to authenticate against this certificate, the
      process that runs the application need to 'hold' sufficient credentials in order to
      get an access to the certificate and to do the authentication. Here comes our problem;
      when trying to access this certificate through the asp.net application, we run into
      a problem - It's impossible, because the process that runs the web application is
      ASPNET and doesn't has the needed credentials in order to authenticate the certificate
      and get the info from the 3rd level.
   </p>
        <p>
          <strong>Suggested solutions:<br /></strong>
        </p>
        <ol>
          <li>
            <strong>Credentials</strong>. Read the credentials from the web.config (username,
         password and domain) and impersonate the user using these credentials. This will
         'save' the impersonated user all over the impersonation context (<font size="2">System.Security.Principal.WindowsImpersonationContext</font>)
         and the authenicate action against the certificate will be done using this credentials.
         One more important thing, to ensure this data protected, encrypt it before puting
         it into the web.config. 
      </li>
          <li>
         I thought about <strong>IIS Application Pool.</strong> This is a great feature that
         came up in IIS 6.0, which enables you the ability of creating one or more applications
         and allows us to configure a level of isolation between different Web applications.
         You can set the identity of an application pool which will be the account under which
         the application pool's worker process runs. So I thought to set it over there, but
         I had one big problem, an IIS 5 was installed on the production server and it is not
         a dedicated server. (More details about application pool <a href="http://www.developer.com/net/asp/article.php/2245511" target="_blank">here</a>). 
      </li>
          <li>
            <strong>Host .NET component in COM+</strong>. This is the third solution and the best
         for me at the current circumstances; Because I am working with a several applications
         (assemblies) I want to host the component that validates the user against the
         3rd level party, this will give me a unified behavoir for all the applications while
         doing this action (Instead of setting these properties in web.config file of
         each web application we want to use {solution 1, remember?}). In other words,
         I'll set the username and password on the COM+ component just once in order to grant
         the process that runs this component the right and sufficient credentials. .NET
         provides a way to host your .NET components inside COM+ environment. All the functionality
         you need to write a COM+ aware component in .NET can be found in System.EnterpriseServices
         namespace.</li>
        </ol>
        <p>
          <strong>So how we do it (hosting .NET assembly in COM+)?</strong>
        </p>
        <p>
      Take a look on this code:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Collections.Generic;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Text;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.EnterpriseServices;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.IO;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Reflection;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Runtime.InteropServices;<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">namespace</span> ComPlusTest<br />
      {<br />
          [Transaction(TransactionOption.Required), 
      <br />
              ObjectPooling(MinPoolSize=2, MaxPoolSize=5,
      CreationTimeout=20000),<br />
              ComVisible(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">true</span>)]<br />
          <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> TestClass
      : ServicedComponent<br />
          {<br />
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">protected</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">override</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Activate()<br />
              {<br />
                  <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">base</span>.Activate();<br />
                  DoSomeAction(Action
      activate)<br />
              }<br /><br />
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">protected</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">override</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Deactivate()<br />
              {<br />
                  <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">base</span>.Deactivate();<br />
                  DoSomeAction(Action
      deactivate)<br />
              }<br /><br />
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">protected</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">override</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">bool</span> CanBePooled()<br />
              {<br />
                  DoSomeAction(Action
      pooled)<br />
                  <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">base</span>.CanBePooled();<br />
              }</span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">        <font color="#0000ff">public
      void</font> ValidateAddress(<font color="#0000ff">string</font> address)<br />
              {<br />
                  <font color="#0000ff">try</font><br />
                  {<br />
                     //
      Do the validation against the 3rd party<br />
                     ContextUtil.SetComplete();<br />
                  }<br />
                  <font color="#0000ff">catch</font>(Exception
      ex)<br />
                  {<br />
                     //
      Handle exception<br />
                     ContextUtil.SetAbort();<br />
                  }<br />
              }<br /></span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <br />
              [AutoComplete()]<br />
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> JustAction()<br />
              {<br />
                  DoSomeAction(Action
      simpleAction);<br />
              }<br /><br />
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> DoSomeAction(Action
      act)<br />
              {<br />
                  <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
      Do the action</span><br />
              }<br />
          }<br />
      }<br /></span>
        </p>
        <p>
      Lets dissect it:
   </p>
        <ol>
          <li>
         Firstable you can see that the class is derived from ServicesComponent (which sits
         in the System.EnterpriseServices namespace). I marked our TestClass with some attributes.
         The first one in Transaction; The values for this attribute are same as in traditional
         VB/VC++ development i.e. Required, RequiresNew, Supported etc. MinPoolSize and MaxPoolSize
         specifies values for minimum and maximum object instances. The ComVisible attribute <strong>must </strong>be
         set to true to give the accessibility of an individual managed type or member, or
         of all types within an assembly, to COM (I spent lots of time trying to figure out
         some exceptions that I had while overriding the ServicesComponent class). 
      </li>
          <li>
         the class is marked to require a transaction each method will execute in a transaction
         (existing or new). Once the ValidateAddress has been executed we need to either commit
         or rollback the transaction. This is done via static methods of <strong>ContextUtil</strong> class.
         The method <strong>SetComplete</strong> is used to commit a transaction where as SetAbort
         is used to rollback a transaction. 
      </li>
          <li>
         Just for example, I defined a methid called JustAction. This method is marked with
         an attribute <strong>AutoComplete</strong> which means that once the method execution
         is over the transaction is automatically committed (equivalent to ContextUtil.SetComplete).
         In case of any error the transaction will be rolled back (equivalent to ContextUtil.SetAbort). 
      </li>
          <li>
         Overrided Activate, Deactivate and CanBePooled methods are just for testing (in
         order to observe the flow behavior).</li>
        </ol>
        <p>
      Now, you have to sign your assembly with a strong name and to add the following attributes
      to the AssemblyInfo class of your project:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">[assembly:
      ApplicationName(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"ComPlusTest"</span>)]<br />
      [assembly: ApplicationActivation(ActivationOption.Library)]<br />
      [assembly: AssemblyKeyFileAttribute(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"ComPlusKey.pfx"</span>)]</span>
        </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=532c3302-dde3-4abd-a652-1864b13cf8b4" />
      </body>
      <title>Hosting .NET Assembly in COM+ Situation</title>
      <guid>http://www.eranachum.com/PermaLink,guid,532c3302-dde3-4abd-a652-1864b13cf8b4.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,532c3302-dde3-4abd-a652-1864b13cf8b4.aspx</link>
      <pubDate>Tue, 10 Jul 2007 14:49:24 GMT</pubDate>
      <description>&lt;p&gt;
   I am working against 3rd level party assembly in my current web application. I need
   to send US address information to this&amp;nbsp;assembly and to retrieve an answer whether
   this address is exist or not. This assembly requires validation against X.509 certificate
   (to ensure that only permited client could use the 3rd level's services), which is
   installed on the server that runs the application (in dev environment this is my local
   PC). 
   &lt;br&gt;
   More details about it &lt;a href="http://www.codeproject.com/useritems/X509Certificate.asp" target=_blank&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;The problem:&lt;/strong&gt; In order to authenticate against this certificate, the
   process that runs the application need to 'hold' sufficient credentials in order to
   get an access to the certificate and to do the authentication. Here comes our problem;
   when trying to access this certificate through the asp.net application, we run into
   a problem - It's impossible, because the process that runs the web application is
   ASPNET and doesn't has the needed credentials in order to authenticate the certificate
   and get the info from the 3rd level.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Suggested solutions:&lt;br&gt;
   &lt;/strong&gt;
&lt;/p&gt;
&lt;ol&gt;
   &lt;li&gt;
      &lt;strong&gt;Credentials&lt;/strong&gt;. Read the credentials from the web.config (username,
      password and domain) and&amp;nbsp;impersonate the user using these credentials. This will
      'save' the impersonated user all over the&amp;nbsp;impersonation context (&lt;font size=2&gt;System.Security.Principal.WindowsImpersonationContext&lt;/font&gt;)
      and the authenicate action against the certificate will be done using this credentials.
      One more important thing, to ensure this data protected, encrypt it before puting
      it into the web.config. 
   &lt;li&gt;
      I thought about &lt;strong&gt;IIS Application Pool.&lt;/strong&gt; This is a great feature that
      came up in IIS 6.0, which enables you the ability of creating one or more applications
      and allows us to configure a level of isolation between different Web applications.
      You can set the identity of an application pool which will be the account under which
      the application pool's worker process runs. So I thought to set it over there, but
      I had one big problem, an IIS 5 was installed on the production server and it is not
      a dedicated server. (More details about application pool &lt;a href="http://www.developer.com/net/asp/article.php/2245511" target=_blank&gt;here&lt;/a&gt;). 
   &lt;li&gt;
      &lt;strong&gt;Host .NET component in COM+&lt;/strong&gt;. This is the third solution and the best
      for me at the current circumstances; Because I am working with a several&amp;nbsp;applications
      (assemblies) I want to host the&amp;nbsp;component that validates the user against the
      3rd level party, this will give me a unified behavoir for all the applications while
      doing this action (Instead of setting these properties in&amp;nbsp;web.config file of
      each web application we want to use&amp;nbsp;{solution 1, remember?}). In other words,
      I'll set the username and password on the COM+ component just once&amp;nbsp;in order to&amp;nbsp;grant
      the process that runs this component the right and sufficient credentials.&amp;nbsp;.NET
      provides a way to host your .NET components inside COM+ environment. All the functionality
      you need to write a COM+ aware component in .NET can be found in System.EnterpriseServices
      namespace.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
   &lt;strong&gt;So how we do it (hosting .NET assembly in COM+)?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   Take a look on this code:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System;&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Text;&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.EnterpriseServices;&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.IO;&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Reflection;&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Runtime.InteropServices;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;namespace&lt;/span&gt; ComPlusTest&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[Transaction(TransactionOption.Required), 
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ObjectPooling(MinPoolSize=2, MaxPoolSize=5,
   CreationTimeout=20000),&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ComVisible(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/span&gt;)]&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; TestClass
   : ServicedComponent&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;protected&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;override&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Activate()&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;base&lt;/span&gt;.Activate();&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DoSomeAction(Action
   activate)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;protected&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;override&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Deactivate()&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;base&lt;/span&gt;.Deactivate();&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DoSomeAction(Action
   deactivate)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;protected&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;override&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;bool&lt;/span&gt; CanBePooled()&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DoSomeAction(Action
   pooled)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;base&lt;/span&gt;.CanBePooled();&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;public
   void&lt;/font&gt; ValidateAddress(&lt;font color=#0000ff&gt;string&lt;/font&gt; address)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;try&lt;/font&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Do the validation against the 3rd party&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ContextUtil.SetComplete();&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#0000ff&gt;catch&lt;/font&gt;(Exception
   ex)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Handle exception&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ContextUtil.SetAbort();&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[AutoComplete()]&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; JustAction()&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DoSomeAction(Action
   simpleAction);&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; DoSomeAction(Action
   act)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
   Do the action&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   }&lt;br&gt;
&lt;/p&gt;
&gt; 
&lt;p&gt;
   Lets dissect it:
&lt;/p&gt;
&lt;ol&gt;
   &lt;li&gt;
      Firstable you can see that the class is derived from ServicesComponent (which sits
      in the System.EnterpriseServices namespace). I marked our TestClass with some attributes.
      The first one in Transaction; The values for this attribute are same as in traditional
      VB/VC++ development i.e. Required, RequiresNew, Supported etc. MinPoolSize and MaxPoolSize
      specifies values for minimum and maximum object instances. The ComVisible attribute &lt;strong&gt;must &lt;/strong&gt;be
      set to true to give the accessibility of an individual managed type or member, or
      of all types within an assembly, to COM (I spent lots of time trying to figure out
      some exceptions that I had while overriding the ServicesComponent class). 
   &lt;li&gt;
      the class is marked to require a transaction each method will execute in a transaction
      (existing or new). Once the ValidateAddress has been executed we need to either commit
      or rollback the transaction. This is done via static methods of &lt;strong&gt;ContextUtil&lt;/strong&gt; class.
      The method &lt;strong&gt;SetComplete&lt;/strong&gt; is used to commit a transaction where as SetAbort
      is used to rollback a transaction. 
   &lt;li&gt;
      Just for example, I defined a methid called JustAction. This method is marked with
      an attribute &lt;strong&gt;AutoComplete&lt;/strong&gt; which means that once the method execution
      is over the transaction is automatically committed (equivalent to ContextUtil.SetComplete).
      In case of any error the transaction will be rolled back (equivalent to ContextUtil.SetAbort). 
   &lt;li&gt;
      Overrided&amp;nbsp;Activate, Deactivate and CanBePooled methods are just for testing (in
      order to observe the flow behavior).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
   Now, you have to sign your assembly with a strong name and to add the following attributes
   to the AssemblyInfo class of your project:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;[assembly:
   ApplicationName(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"ComPlusTest"&lt;/span&gt;)]&lt;br&gt;
   [assembly: ApplicationActivation(ActivationOption.Library)]&lt;br&gt;
   [assembly: AssemblyKeyFileAttribute(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"ComPlusKey.pfx"&lt;/span&gt;)]&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=532c3302-dde3-4abd-a652-1864b13cf8b4" /&gt;</description>
      <category>.NET 2005;ASP.NET;Code;System</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=56a8bc57-723a-45d2-b208-f17b5e9a2d84</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,56a8bc57-723a-45d2-b208-f17b5e9a2d84.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I got an email the other day from Omer Rauchwerger, the developer and the man who
      stands behind a nice tool (addin that runs over the Visual Studio 2005) called <strong>Regionerate</strong>.
      I had requested to 'play' with this tool and give an opinion about it, and
      so I did... 
   </p>
        <p>
          <em>(Note: I heard about it earlier than Omer's email, Ken Egozi's had posted
      about it on his </em>
          <a href="http://www.kenegozi.com/blog/" target="_blank">
            <em>blog</em>
          </a>
          <em>).</em>
        </p>
        <p>
      Before I outlines my impressions, comments and feelings about it, I want to give some
      words about the Regionerate website itself; The man did here realy good job. There
      are great detailed demo movie that displays the work of the tool, some tutorials,
      gallery and more...
   </p>
        <p>
      About the tool, well I'd downloaded the latest version (beta) on my PC and
      played with it a little bit. The usage is very convinient and indeed saves time while
      reagioning your code, it all being done by a single right click and gives nice and
      elegant outcome.
   </p>
        <p>
      I very impressed from the custom Code Layout of this tool; By Using this tool you
      can customize your final layout of code by simple XML file editing (fully intellisense
      adapted).
   </p>
        <p>
      On the  end of the day, a great work has been done here and I am looking for
      more innovetions in the next versions and for the final release of course.
   </p>
        <p>
      Omer, if you'll find a way to give the ability of titling each specific region
      in addition to the current titles (before regioning of course) it will be great
      one.
   </p>
        <p>
      Download is <a href="http://www.rauchy.net/regionerate/" target="_blank">here</a>.
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=56a8bc57-723a-45d2-b208-f17b5e9a2d84" />
      </body>
      <title>Regionerate by Omer Rauchwerger</title>
      <guid>http://www.eranachum.com/PermaLink,guid,56a8bc57-723a-45d2-b208-f17b5e9a2d84.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,56a8bc57-723a-45d2-b208-f17b5e9a2d84.aspx</link>
      <pubDate>Wed, 04 Jul 2007 06:44:49 GMT</pubDate>
      <description>&lt;p&gt;
   I got an email the other day from Omer Rauchwerger, the developer and the man&amp;nbsp;who
   stands behind a nice tool (addin that runs over the Visual Studio 2005) called &lt;strong&gt;Regionerate&lt;/strong&gt;.
   I had requested to 'play'&amp;nbsp;with this&amp;nbsp;tool and give an opinion about it, and
   so I did... 
&lt;/p&gt;
&lt;p&gt;
   &lt;em&gt;(Note: I&amp;nbsp;heard about it earlier than&amp;nbsp;Omer's email, Ken Egozi's had posted
   about it on his &lt;/em&gt;&lt;a href="http://www.kenegozi.com/blog/" target=_blank&gt;&lt;em&gt;blog&lt;/em&gt;&lt;/a&gt;&lt;em&gt;).&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
   Before I outlines my impressions, comments and feelings about it, I want to give some
   words about the Regionerate website itself; The man did here realy good job. There
   are great detailed demo movie that displays the work of the tool, some tutorials,
   gallery and more...
&lt;/p&gt;
&lt;p&gt;
   About the tool, well I'd downloaded&amp;nbsp;the latest version (beta)&amp;nbsp;on my PC and
   played with it a little bit. The usage is very convinient and indeed saves time while
   reagioning your code, it all being done by a single right click and gives nice and
   elegant outcome.
&lt;/p&gt;
&lt;p&gt;
   I very impressed from the custom Code Layout of this tool; By Using this tool you
   can customize your final layout of code by simple XML file editing&amp;nbsp;(fully intellisense
   adapted).
&lt;/p&gt;
&lt;p&gt;
   On the&amp;nbsp; end of the day, a great work has been done here and I am looking for
   more innovetions in the next versions and for the final release of course.
&lt;/p&gt;
&lt;p&gt;
   Omer,&amp;nbsp;if you'll find a way&amp;nbsp;to give the ability of&amp;nbsp;titling each specific&amp;nbsp;region
   in addition to the current&amp;nbsp;titles (before regioning of course) it will be great
   one.
&lt;/p&gt;
&lt;p&gt;
   Download is &lt;a href="http://www.rauchy.net/regionerate/" target=_blank&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=56a8bc57-723a-45d2-b208-f17b5e9a2d84" /&gt;</description>
      <category>.NET 2005;Other</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=11f0552d-7bfc-4f1c-9154-f5c391e4b9ee</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,11f0552d-7bfc-4f1c-9154-f5c391e4b9ee.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I had a performance problem in my current working on web application; In one of my
      flows in this application, I had needed to call the database and to update some large
      amount of data over there, but this action had taken lots of time and the outcome
      was that users had to wait a long time until this action will be done, admit it, it
      is frustrating...
   </p>
        <p>
      My first kind of solution to this problem was to create a new thred from the IIS's
      thread pool and to assign this action under it - quite good resolution not? BUT,
      I reminded that asp.net 2.0 (also 1.X) already implements it in a better and friendly
      way, using <strong>Asynchronous Pages</strong>.
   </p>
        <p>
          <em>But first, some Background...<br /></em>As we all know (or not), when ASP.NET receives a request from the user, it ask
      for a thread from a thread pool and assigns that request to the thread. In order
      to this action, the synchronous page holds this thread for the duration of the request,
      and preventing it from being used by other requests. That leads us to my problem:
      when I am calling to the database and doing the long long action (an UPDATE query),
      the thread assigned to the request is <strong>stuck</strong> doing nothing until the
      call returns. (This happens because the thread pool has a finite number of threads
      available). 
   </p>
        <p>
          <em>The Resolution is (of course) </em>
          <strong>Asynchronous Pages.</strong>
        </p>
        <p>
      Asynchronous pages offers a neat solution to such kind of problems. Once an asynchronous
      operation begins in response to a signal from ASP.NET, the page returns the used thread
      to the thread pool. When this operation completes, this mechanism asks for another
      thread from the thread pool and finishes processing the request. This mechanism helps
      us to manage more efficiently the threads manipulation from the thread pool,
      because threads that were stucked earlier, now can be used for other porpuses.
   </p>
        <p>
      Lets see some code:
   </p>
        <p>
      Firstable, you need to set the Async property on the top on the asp.net page in order
      to use this thing:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">&lt;%@Page
      Language=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"C#"</span> Async=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"true"</span> ...
      %&gt;</span>
        </p>
        <p>
      This property set to true, says the page to implement the <strong>IHttpAsyncHandler</strong>.
      Regarding this, you need to register the Begin method and End method of to the <strong>Page.AddOnPreRenderCompleteAsync.</strong></p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
      Register async methods</span>
            <br />
      AddOnPreRenderCompleteAsync(<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   new</span> BeginEventHandler(BeginAsyncOperation),<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   new</span> EndEventHandler(EndAsyncOperation)<br />
      );<br /></span>
        </p>
        <p>
      By these actions, the starts its normal life cycle, until the end of the OnPreRender
      event invocation. At this point the ASP.NET calls the Begin method that we registered
      earlier and the operation begins (calling the database etc...), meanwhile, the thread
      that has been assigned to the request goeas back to the thread pool. At the end of
      the Begin method, an IAsyncResult is being sent automatically to the ASP.NET and let
      it determine in the operation had completed, a new thread is being called from the
      thread pool and there is call to the End method (that we registered earlier, remmember?). 
   </p>
        <p>
          <strong>Note:</strong> We do <u>not</u> need to implement the IAsyncResult interface,
      the Framework implements it for us.
   </p>
        <p>
      The Begin and End Methods:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">IAsyncResult
      BeginAsyncOperation (<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender,
      EventArgs e, AsyncCallback cb, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> state)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Do your things...</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Call the DB and run the long long query...</span><br />
      }<br /></span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> EndAsyncOperation(IAsyncResult
      ar)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Do your things...</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Get a response from the DB that the operation is DONE...</span><br />
      }<br /></span>
        </p>
        <p>
      Nide ahhhu? So use it wisely...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=11f0552d-7bfc-4f1c-9154-f5c391e4b9ee" />
      </body>
      <title>Asynchronous Pages in ASP.NET 2.0 - Examination and Walkthrough</title>
      <guid>http://www.eranachum.com/PermaLink,guid,11f0552d-7bfc-4f1c-9154-f5c391e4b9ee.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,11f0552d-7bfc-4f1c-9154-f5c391e4b9ee.aspx</link>
      <pubDate>Sun, 01 Jul 2007 09:26:35 GMT</pubDate>
      <description>&lt;p&gt;
   I had a performance problem in my current working on web application; In one of my
   flows in this application, I had needed to call the database and to update some large
   amount of data over there, but this action had taken lots of time and the outcome
   was that users had to wait a long time until this action will be done, admit it, it
   is frustrating...
&lt;/p&gt;
&lt;p&gt;
   My first kind of solution to this problem was to create a new thred from the IIS's
   thread pool and to&amp;nbsp;assign this action under it - quite good resolution not? BUT,
   I reminded that asp.net 2.0 (also 1.X) already implements it in a better and friendly
   way, using &lt;strong&gt;Asynchronous Pages&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
   &lt;em&gt;But first, some Background...&lt;br&gt;
   &lt;/em&gt;As we all know (or not), when ASP.NET receives a request from the user, it&amp;nbsp;ask
   for&amp;nbsp;a thread from a thread pool and assigns that request to the thread. In order
   to this action, the synchronous page holds this thread for the duration of the request,
   and preventing it from being used by other requests. That leads us to my problem:
   when I am calling to the database and doing the long long action (an UPDATE query),
   the thread assigned to the request is &lt;strong&gt;stuck&lt;/strong&gt; doing nothing until the
   call returns. (This happens because the thread pool has a finite number of threads
   available). 
&lt;/p&gt;
&lt;p&gt;
   &lt;em&gt;The Resolution is (of course) &lt;/em&gt;&lt;strong&gt;Asynchronous Pages.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   Asynchronous pages offers a neat solution to such kind of problems. Once&amp;nbsp;an asynchronous
   operation begins in response to a signal from ASP.NET, the page returns the used thread
   to the thread pool. When this operation completes, this mechanism asks for another
   thread from the thread pool and finishes processing the request. This mechanism helps
   us to manage&amp;nbsp;more efficiently the threads manipulation from the thread pool,
   because threads that were stucked earlier, now can be used for other porpuses.
&lt;/p&gt;
&lt;p&gt;
   Lets see some code:
&lt;/p&gt;
&lt;p&gt;
   Firstable, you need to set the Async property on the top on the asp.net page in order
   to use this thing:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;lt;%@Page
   Language=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"C#"&lt;/span&gt; Async=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"true"&lt;/span&gt; ...
   %&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   This property set to true, says the page to implement the &lt;strong&gt;IHttpAsyncHandler&lt;/strong&gt;.
   Regarding this, you need to register the Begin method and End method of to the &lt;strong&gt;Page.AddOnPreRenderCompleteAsync.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
   Register async methods&lt;/span&gt;
   &lt;br&gt;
   AddOnPreRenderCompleteAsync(&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&lt;/span&gt; BeginEventHandler(BeginAsyncOperation),&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&lt;/span&gt; EndEventHandler(EndAsyncOperation)&lt;br&gt;
   );&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   By these actions, the starts its normal life cycle, until the end of the OnPreRender
   event invocation. At this point the ASP.NET calls the Begin method that we registered
   earlier and the operation begins (calling the database etc...), meanwhile, the thread
   that has been assigned to the request goeas back to the thread pool. At the end of
   the Begin method, an IAsyncResult is being sent automatically to the ASP.NET and let
   it determine in the operation had completed, a new thread is being called from the
   thread pool and there is call to the End method (that we registered earlier, remmember?). 
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Note:&lt;/strong&gt; We do &lt;u&gt;not&lt;/u&gt; need to implement the IAsyncResult interface,
   the Framework implements it for us.
&lt;/p&gt;
&lt;p&gt;
   The Begin and End Methods:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;IAsyncResult
   BeginAsyncOperation (&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender,
   EventArgs e,&amp;nbsp;AsyncCallback cb, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; state)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Do your things...&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Call the DB and run the long long query...&lt;/span&gt;
   &lt;br&gt;
   }&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; EndAsyncOperation(IAsyncResult
   ar)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Do your things...&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Get a response from the DB that the operation is DONE...&lt;/span&gt;
   &lt;br&gt;
   }&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Nide ahhhu? So use it wisely...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=11f0552d-7bfc-4f1c-9154-f5c391e4b9ee" /&gt;</description>
      <category>.NET 2005;ASP.NET;Multi-threading</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=87001ec1-655f-4084-8910-16d707f0680a</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,87001ec1-655f-4084-8910-16d707f0680a.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      These days I am working on a very big web application...
   </p>
        <p>
      In one of my aspx pages I had needed to save lots of data in the ViewState object in
      order to persist data between postbacks, but when I looked at the rendered HTML, I
      saw a large hidden field for carring the ViewState.
   </p>
        <p>
      ASP.NET 2.0 came up with a new feature that helps to reduce the amount of the hidden
      filed's ViewState data that called: <strong>PageStatePersister. </strong></p>
        <p>
      When we add an override the <b>PageStatePersister</b> property and use the built-in <b>SessionPageStatePersister</b>,
      the behavior of the page remains the same, but the storage used for the bulk of the
      state data is shifted from the hidden field to session state.
   </p>
        <p>
      Implamantation instance:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">protected</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">override</span> PageStatePersister
      PageStatePersister<br />
      {<br />
         get { <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> SessionPageStatePersister(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>);
      }<br />
      }<br /></span>
        </p>
        <p>
      In several cases you'll only want to override this property in your page and to shift
      the ViewState data into the Sesson object, but if you'll want to use it (wisely of
      course) on your entire web application? You should implement this property in a particular
      custom base page and to inherit it to all of your application pages.
   </p>
        <p>
      The only disadventage that I could think about here is the data existent, session
      can lose its data and information if its timeout has ended, but ViewState can hold
      the data forever on the page, because it's hard coded.
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=87001ec1-655f-4084-8910-16d707f0680a" />
      </body>
      <title>How to reduce the ViewState weight on a aspx page? or ASP.NET 2.0 Page State Persister</title>
      <guid>http://www.eranachum.com/PermaLink,guid,87001ec1-655f-4084-8910-16d707f0680a.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,87001ec1-655f-4084-8910-16d707f0680a.aspx</link>
      <pubDate>Sun, 10 Jun 2007 13:08:17 GMT</pubDate>
      <description>&lt;p&gt;
   These days I am working on a very big web application...
&lt;/p&gt;
&lt;p&gt;
   In one of my aspx pages I had needed to save lots of data in the&amp;nbsp;ViewState object&amp;nbsp;in
   order to persist data between postbacks, but when I looked at the rendered HTML, I
   saw a large hidden field for carring the ViewState.
&lt;/p&gt;
&lt;p&gt;
   ASP.NET 2.0 came up with a new feature that helps to reduce the amount of the hidden
   filed's ViewState data that called: &lt;strong&gt;PageStatePersister. &lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   When we add an override the &lt;b&gt;PageStatePersister&lt;/b&gt; property and use the built-in &lt;b&gt;SessionPageStatePersister&lt;/b&gt;,
   the behavior of the page remains the same, but the storage used for the bulk of the
   state data is shifted from the hidden field to session state.
&lt;/p&gt;
&lt;p&gt;
   Implamantation&amp;nbsp;instance:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;protected&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;override&lt;/span&gt; PageStatePersister
   PageStatePersister&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;get { &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; SessionPageStatePersister(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;);
   }&lt;br&gt;
   }&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   In several cases you'll only want to override this property in your page and to shift
   the ViewState data into the Sesson object, but if you'll want to use it (wisely of
   course) on your entire web application? You should implement this property in a particular
   custom base page and to inherit it to all of your application pages.
&lt;/p&gt;
&lt;p&gt;
   The only disadventage that I could think about here is the data existent, session
   can lose its data and information if its timeout has ended, but ViewState can hold
   the data forever on the page, because it's hard coded.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=87001ec1-655f-4084-8910-16d707f0680a" /&gt;</description>
      <category>.NET 2005;Code</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=7d509ea5-bf93-41c7-a07c-0d265753fa5f</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,7d509ea5-bf93-41c7-a07c-0d265753fa5f.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I am working now on a large web application, that need to be used by more than one
      websites (at least 5 of them, websites and web services), therefore I have needed
      to do some isolating here with my main core projects.
   </p>
        <p>
      Some background...<br />
      I have a common assembly (web application) that holds only the user controls,
      server controls and custom controls, which need to serve the all other web applications
      that are using them. This assembly has a reference to the other web application in
      order to have some information about some properties, session variables and global
      members, by this information, it knows to gereate some actions on runtime (or even
      in design). BUT, in the other hand, this web application need to use the controls
      that the first assembly has published, here we have a <strong>problem</strong>, we
      got a circular references, which is now allowed in .NET framework, also it isn't allowed
      anywhere I think...
   </p>
        <p>
      So, how we gonna solve this problem?
   </p>
        <p>
      The solution is quite simple and is known as <strong>Seperate Interface Pattern</strong>.
      (Click <a href="http://www.martinfowler.com/eaaCatalog/separatedInterface.html" target="_blank">here</a> to
      get some more info).
   </p>
        <p>
      The main steps to implement it are:<br />
      Let define a project that called <strong>ProjectA</strong> and holds the
      user controls (etc...) implementations along with <strong>InterfaceB</strong>. <strong>ProjectA</strong> would
      maintain a reference to <strong>InterfaceB</strong>, which will hold any properties
      such as members, methods, events etc...
   </p>
        <p>
      Now, lets define <strong>ProjectB</strong> which will implement <strong>InterfaceA</strong>.
      Now, <strong>ProjectB</strong> would reference <strong>ProjectA</strong> and (BUT) <strong>ProjectA</strong> would
      not reference <strong>ProjectB</strong> of course.
   </p>
        <p>
      The result, ProjectA can access to ProjectB's specific exposed members and ProjectB
      can use the controls of ProjectA.
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=7d509ea5-bf93-41c7-a07c-0d265753fa5f" />
      </body>
      <title>Circular References or How to solve this problem?</title>
      <guid>http://www.eranachum.com/PermaLink,guid,7d509ea5-bf93-41c7-a07c-0d265753fa5f.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,7d509ea5-bf93-41c7-a07c-0d265753fa5f.aspx</link>
      <pubDate>Thu, 31 May 2007 12:26:25 GMT</pubDate>
      <description>&lt;p&gt;
   I am working now on a large web application, that need to be used by more than one
   websites (at least 5 of them, websites and web services), therefore I have needed
   to do some isolating here with my main core projects.
&lt;/p&gt;
&lt;p&gt;
   Some background...&lt;br&gt;
   I have a common&amp;nbsp;assembly (web application) that holds only the user controls,
   server controls and custom controls, which need to serve the all other web applications
   that are using them. This assembly has a reference to the other web application in
   order to have some information about some properties, session variables&amp;nbsp;and global
   members, by this information, it knows to gereate some actions on runtime (or even
   in design). BUT, in the other hand, this web application need to use the controls
   that the first assembly has published, here we have a &lt;strong&gt;problem&lt;/strong&gt;, we
   got a circular references, which is now allowed in .NET framework, also it isn't allowed
   anywhere I think...
&lt;/p&gt;
&lt;p&gt;
   So, how we gonna solve this problem?
&lt;/p&gt;
&lt;p&gt;
   The solution is quite simple and is known as &lt;strong&gt;Seperate Interface Pattern&lt;/strong&gt;.
   (Click &lt;a href="http://www.martinfowler.com/eaaCatalog/separatedInterface.html" target=_blank&gt;here&lt;/a&gt; to
   get some more info).
&lt;/p&gt;
&lt;p&gt;
   The main steps to implement it are:&lt;br&gt;
   Let&amp;nbsp;define a project that called &lt;strong&gt;ProjectA&lt;/strong&gt;&amp;nbsp;and holds the
   user controls (etc...) implementations along with &lt;strong&gt;InterfaceB&lt;/strong&gt;. &lt;strong&gt;ProjectA&lt;/strong&gt; would
   maintain a reference to &lt;strong&gt;InterfaceB&lt;/strong&gt;, which will hold any properties
   such as members, methods, events etc...
&lt;/p&gt;
&lt;p&gt;
   Now, lets define &lt;strong&gt;ProjectB&lt;/strong&gt; which will implement &lt;strong&gt;InterfaceA&lt;/strong&gt;.
   Now, &lt;strong&gt;ProjectB&lt;/strong&gt; would reference &lt;strong&gt;ProjectA&lt;/strong&gt; and (BUT) &lt;strong&gt;ProjectA&lt;/strong&gt; would
   not reference &lt;strong&gt;ProjectB&lt;/strong&gt; of course.
&lt;/p&gt;
&lt;p&gt;
   The result, ProjectA can access to ProjectB's specific exposed&amp;nbsp;members and ProjectB
   can use the controls of ProjectA.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=7d509ea5-bf93-41c7-a07c-0d265753fa5f" /&gt;</description>
      <category>.NET 2005;Bugs;Code;Patterns</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=23d7f48a-2af9-4350-a0d3-25d4f08a3d67</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,23d7f48a-2af9-4350-a0d3-25d4f08a3d67.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hi fellows, how are you?
   </p>
        <p>
      I read a nice article regarding editing and encrypting/decrypting web.config
      sections. The nicest thing in that feature is the ability to access to the web.config
      content via the actual code behind (and) in run-time. (Could be a lot of reasons
      to access the file from the code itself, and the API is very 'friendly').
   </p>
        <p>
      Click <a href="http://www.c-sharpcorner.com/UploadFile/neo_matrix/EditWebConfig05042007091116AM/EditWebConfig.aspx" target="_blank">here</a> to
      get the directive to this article.
   </p>
        <p>
      Bye bye...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=23d7f48a-2af9-4350-a0d3-25d4f08a3d67" />
      </body>
      <title>Edit and encrypt Web.Config sections using C# 2.0</title>
      <guid>http://www.eranachum.com/PermaLink,guid,23d7f48a-2af9-4350-a0d3-25d4f08a3d67.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,23d7f48a-2af9-4350-a0d3-25d4f08a3d67.aspx</link>
      <pubDate>Thu, 17 May 2007 08:23:55 GMT</pubDate>
      <description>&lt;p&gt;
   Hi fellows, how are you?
&lt;/p&gt;
&lt;p&gt;
   I read&amp;nbsp;a nice article regarding editing and encrypting/decrypting web.config
   sections. The nicest thing in that feature is the ability to access to the web.config
   content via the actual code behind (and) in run-time. (Could be&amp;nbsp;a lot of reasons
   to access the file from the code itself, and the API is very 'friendly').
&lt;/p&gt;
&lt;p&gt;
   Click&amp;nbsp;&lt;a href="http://www.c-sharpcorner.com/UploadFile/neo_matrix/EditWebConfig05042007091116AM/EditWebConfig.aspx" target=_blank&gt;here&lt;/a&gt;&amp;nbsp;to
   get the directive to this article.
&lt;/p&gt;
&lt;p&gt;
   Bye bye...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=23d7f48a-2af9-4350-a0d3-25d4f08a3d67" /&gt;</description>
      <category>.NET 2005;Code;Security</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=f82907c5-5740-4bd3-9b0c-2d844c28a027</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,f82907c5-5740-4bd3-9b0c-2d844c28a027.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hi again..
   </p>
        <p>
      I am here again with the same issue, and this is because a long conversation that
      I had with <a href="http://www.eranachum.com/www.lnbogen.com" target="_blank">Oren
      Ellenbogen</a> (ex. co-worker) about some extending and refactoring of the former
      post solution (you can see it <a href="http://www.eranachum.com/PermaLink,guid,60b3bb92-311d-4f6d-8bd8-f76677e20ea5.aspx">here</a> if
      you missed it).
   </p>
        <p>
      The main goal in the Session/Application objects encapsulation was the ability of
      avoiding casting each time that we would use these objects, this is annoying especially
      we uses the specific object in most of the flows of the application.<br />
      The other goal is getting the ability of managing these objects in one centered place.
   </p>
        <p>
      NOW, some extesibility...<br />
      This object need to be maintened everytime that we want to add a new session/application
      object. Good usage of generics will solve this problem -&gt; this will bring up the
      ability of adding new objects everywhere that we'll want (example in the continuance...).
   </p>
        <p>
      So, look at the following implemetation:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> SessionRepository<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">bool</span> IsExist(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> objectKey)<br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      return</span> HttpContext.Current.Session[objectKey]
      !<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>;<br />
         }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span> TObject
      GetInstance&lt;TObject&gt;(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> objectKey)<br />
         {<br />
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span> (TObject)HttpContext.Current.Session[objectKey];<br />
         }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Add&lt;TObject&gt;(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> objectKey,
      TObject obj)<br />
         {<br />
            HttpContext.Current.Session.Add(objectKey, obj);<br />
         }<br />
      }</span>
        </p>
        <p>
      Some usage:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (SessionRepository.IsExist(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SomeObjectKey"</span>))<br />
      {<br />
         SomeObject obj <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> SessionRepository.GetInstance&lt;SomeObject&gt;(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SomeObjectKey"</span>);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Do your things...</span><br />
      }<br /><br />
      SessionRepository.Add&lt;SomeObject&gt;(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SomeObjectKey"</span>,
      SomeObject);</span>
        </p>
        <p>
      This way of implementation comes to help us with the <strong>casting</strong> issue
      and it gives up extensibilty options. I think that there is a small disadventage here
      - we also need to remeber the keys of the objects in the session object - but there
      is nothing perfect.
   </p>
        <p>
          <strong>
            <u>Summary:</u>
          </strong>
        </p>
        <ol>
          <li>
         Both of the solutions are good and each has each advantages/disadventages, you can
         prefer the best way of using.</li>
          <li>
         The first way (shown in the former post) enables you a direct access to the object
         stays in the session/application, but need to be managed for each time we want to
         add new object into the session/application.</li>
          <li>
         The way shown here holds a different approach, enables you extensibility, but you
         don't have the explicit access to these objects.</li>
          <li>
         In both ways, the casting issue is covered!</li>
        </ol>
        <p>
      That's it for today.
   </p>
        <p>
      Commets will be appriciated...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=f82907c5-5740-4bd3-9b0c-2d844c28a027" />
      </body>
      <title>Some Encapsulation (A repository for Session/Application members)  - Part 2</title>
      <guid>http://www.eranachum.com/PermaLink,guid,f82907c5-5740-4bd3-9b0c-2d844c28a027.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,f82907c5-5740-4bd3-9b0c-2d844c28a027.aspx</link>
      <pubDate>Sun, 29 Apr 2007 12:41:05 GMT</pubDate>
      <description>&lt;p&gt;
   Hi again..
&lt;/p&gt;
&lt;p&gt;
   I am here again with the same issue, and this is because a long conversation that
   I had with &lt;a href="http://www.eranachum.com/www.lnbogen.com" target=_blank&gt;Oren Ellenbogen&lt;/a&gt; (ex.
   co-worker) about some extending and refactoring of the former post solution (you can
   see it &lt;a href="http://www.eranachum.com/PermaLink,guid,60b3bb92-311d-4f6d-8bd8-f76677e20ea5.aspx"&gt;here&lt;/a&gt; if
   you missed it).
&lt;/p&gt;
&lt;p&gt;
   The main goal in the Session/Application objects encapsulation was the ability of
   avoiding casting each time that we would use these objects, this is annoying especially
   we uses the specific object in most of the flows of the application.&lt;br&gt;
   The other goal is getting the ability of managing these objects in one centered place.
&lt;/p&gt;
&lt;p&gt;
   NOW, some extesibility...&lt;br&gt;
   This object need to be maintened everytime that we want to add a new session/application
   object. Good usage of generics will solve this problem -&amp;gt; this will bring up the
   ability of adding new objects everywhere that we'll want (example in the continuance...).
&lt;/p&gt;
&lt;p&gt;
   So, look at the following implemetation:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; SessionRepository&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;bool&lt;/span&gt; IsExist(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; objectKey)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/span&gt; HttpContext.Current.Session[objectKey]
   !&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; TObject
   GetInstance&amp;lt;TObject&amp;gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; objectKey)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; (TObject)HttpContext.Current.Session[objectKey];&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Add&amp;lt;TObject&amp;gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; objectKey,
   TObject obj)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;HttpContext.Current.Session.Add(objectKey, obj);&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Some usage:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (SessionRepository.IsExist(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SomeObjectKey"&lt;/span&gt;))&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;SomeObject obj &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; SessionRepository.GetInstance&amp;lt;SomeObject&amp;gt;(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SomeObjectKey"&lt;/span&gt;);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Do your things...&lt;/span&gt;
   &lt;br&gt;
   }&lt;br&gt;
   &lt;br&gt;
   SessionRepository.Add&amp;lt;SomeObject&amp;gt;(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SomeObjectKey"&lt;/span&gt;,
   SomeObject);&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   This way of implementation comes to help us with the &lt;strong&gt;casting&lt;/strong&gt; issue
   and it gives up extensibilty options. I think that there is a small disadventage here
   - we also need to remeber the keys of the objects in the session object - but there
   is nothing perfect.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;&lt;u&gt;Summary:&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;ol&gt;
   &lt;li&gt;
      Both of the solutions are good and each has each advantages/disadventages, you can
      prefer the best way of using.&lt;/li&gt;
   &lt;li&gt;
      The first way (shown in the former post) enables you&amp;nbsp;a direct access to the object
      stays in the session/application, but need to be managed for each time we want to
      add new object into the session/application.&lt;/li&gt;
   &lt;li&gt;
      The way shown here holds a different approach, enables you extensibility, but you
      don't have the explicit access to these objects.&lt;/li&gt;
   &lt;li&gt;
      In both ways, the casting issue is covered!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
   That's it for today.
&lt;/p&gt;
&lt;p&gt;
   Commets will be appriciated...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=f82907c5-5740-4bd3-9b0c-2d844c28a027" /&gt;</description>
      <category>.NET 2005;Code</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=60b3bb92-311d-4f6d-8bd8-f76677e20ea5</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,60b3bb92-311d-4f6d-8bd8-f76677e20ea5.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hi!
   </p>
        <p>
      In most of ourweb applications, we (must) use the session object, which gives us better
      way of data storing (session object lives over the HTTP protocol and exists all over
      the user's session lives {except of expiration etc...}).
   </p>
        <p>
      The access to the session objects and variables is quite easy and simple, <strong>BUT</strong>,
      what happens when you want to store your complex struct or object in the session (even
      some other system object)? <strong>THEN</strong>, you must cast this session variable,
      and check if it alives before you can access its properties etc...
   </p>
        <p>
      I have a good suggestion that also will encapsulate the sesison's variables and
      will be easy to manage, pay attention:
   </p>
        <p>
      Firstable, I created a static class, called: <strong>Repository</strong>, which will
      expose the session variables as properties, and the access to these objects will be
      much more easy and explicit.
   </p>
        <p>
      The repository static class:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> Repository<br />
      {<br />
          <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span> SomeObject
      SessionSomeObject<br />
          {<br />
              get 
      <br />
              {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">           return</span> HttpContext.Current.Session[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SomeObject"</span>] <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span> SomeObject;<br />
              }<br />
              set 
      <br />
              { 
      <br />
                  HttpContext.Current.Session[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SomeObject"</span>] <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value; 
      <br />
              }<br />
          }<br /><br />
          <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
      Some more properties declarations</span><br />
      }</span>
        </p>
        <p>
      (This class gathers all the session/application members = good and convenient code
      management).
   </p>
        <p>
          <strong>NOW,</strong> look at the 'old fashioned' and regular way that the sytax
      suggests us (if we don't use the Repository static class):
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (Session[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SomeObject"</span>]
      !<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)<br /></span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">{<br />
         myObject <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> ((SomeObject)Session[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"SomeObject"</span>]).MyProperty;<br />
      }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span><br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      bla bla bla...</span><br />
      }</span>
        </p>
        <p>
      In the above example, we must check if the object is alive in the session firstly
      if we want to access its properties (unless we do it, it will throw us a runtime error).
      In the bottom example we cover this case with one sentense of code:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">myObject <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Repository.SessionSomeObject.MyProperty;</span>
        </p>
        <p>
      Here, even if the object is null, it will we create an instance of it and will return
      us some default value of the object's property.
   </p>
        <p>
      Have a good day...
   </p>
        <p>
      p.s.<br />
      This code relates also to the Application object!
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=60b3bb92-311d-4f6d-8bd8-f76677e20ea5" />
      </body>
      <title>Some Encapsulation (A repository for Session/Application members)</title>
      <guid>http://www.eranachum.com/PermaLink,guid,60b3bb92-311d-4f6d-8bd8-f76677e20ea5.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,60b3bb92-311d-4f6d-8bd8-f76677e20ea5.aspx</link>
      <pubDate>Thu, 19 Apr 2007 10:19:24 GMT</pubDate>
      <description>&lt;p&gt;
   Hi!
&lt;/p&gt;
&lt;p&gt;
   In most of ourweb applications, we (must) use the session object, which gives us better
   way of data storing (session object lives over the HTTP protocol and exists all over
   the user's session lives {except of expiration etc...}).
&lt;/p&gt;
&lt;p&gt;
   The access to the session objects and variables is quite easy and simple, &lt;strong&gt;BUT&lt;/strong&gt;,
   what happens when you want to store your complex struct or object in the session (even
   some other system object)? &lt;strong&gt;THEN&lt;/strong&gt;, you must cast this session variable,
   and check if it alives before you can access its properties etc...
&lt;/p&gt;
&lt;p&gt;
   I have a good suggestion that also will&amp;nbsp;encapsulate the sesison's variables and
   will be easy to manage, pay attention:
&lt;/p&gt;
&lt;p&gt;
   Firstable, I created a static class, called: &lt;strong&gt;Repository&lt;/strong&gt;, which will
   expose the session variables as properties, and the access to these objects will be
   much more easy and explicit.
&lt;/p&gt;
&lt;p&gt;
   The repository static class:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; Repository&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; SomeObject
   SessionSomeObject&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get 
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/span&gt; HttpContext.Current.Session[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SomeObject"&lt;/span&gt;] &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; SomeObject;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set 
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ 
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;HttpContext.Current.Session[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SomeObject"&lt;/span&gt;] &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value; 
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
   Some more properties declarations&lt;/span&gt;
   &lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   (This class gathers all the session/application members = good and convenient code
   management).
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;NOW,&lt;/strong&gt; look at the 'old fashioned'&amp;nbsp;and regular way that the sytax
   suggests us (if we don't use the Repository static class):
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (Session[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SomeObject"&lt;/span&gt;]
   !&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)&lt;br&gt;
   &lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;myObject &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; ((SomeObject)Session[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"SomeObject"&lt;/span&gt;]).MyProperty;&lt;br&gt;
   }&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt;
   &lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   bla bla bla...&lt;/span&gt;
   &lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   In the above example, we must check if the object is alive in the session firstly
   if we want to access its properties (unless we do it, it will throw us a runtime error).
   In the bottom example we cover this case with one sentense of code:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;myObject &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Repository.SessionSomeObject.MyProperty;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Here, even if the object is null, it will we create an instance of it and will return
   us some default value of the object's property.
&lt;/p&gt;
&lt;p&gt;
   Have a good day...
&lt;/p&gt;
&lt;p&gt;
   p.s.&lt;br&gt;
   This code relates also to the Application object!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=60b3bb92-311d-4f6d-8bd8-f76677e20ea5" /&gt;</description>
      <category>.NET 2005;Code</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=39dc1566-d318-4f47-b30c-9be4716d9087</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,39dc1566-d318-4f47-b30c-9be4716d9087.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      You can download it, it is ready, right from the oven...
   </p>
        <p>
      The best thing that I found there is the <strong>Validation Application Blocks</strong>,
      which is new and wasn't in the earlier versions.<br />
      "Developers can use this application block to create validation rules for business
      objects that can be used across different layers of their applications." (quoted form
      the msdn site).
   </p>
        <p>
      You can find it here: <a href="http://msdn2.microsoft.com/en-us/library/aa480453.aspx">http://msdn2.microsoft.com/en-us/library/aa480453.aspx</a></p>
        <p>
      Enjoy...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=39dc1566-d318-4f47-b30c-9be4716d9087" />
      </body>
      <title>Enterprise Library 3.0 is ready to download</title>
      <guid>http://www.eranachum.com/PermaLink,guid,39dc1566-d318-4f47-b30c-9be4716d9087.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,39dc1566-d318-4f47-b30c-9be4716d9087.aspx</link>
      <pubDate>Wed, 11 Apr 2007 08:40:47 GMT</pubDate>
      <description>&lt;p&gt;
   You can download it, it is ready, right from the oven...
&lt;/p&gt;
&lt;p&gt;
   The best thing that I found there is the &lt;strong&gt;Validation Application Blocks&lt;/strong&gt;,
   which is new and wasn't in the earlier versions.&lt;br&gt;
   "Developers can use this application block to create validation rules for business
   objects that can be used across different layers of their applications." (quoted form
   the msdn site).
&lt;/p&gt;
&lt;p&gt;
   You can find it here: &lt;a href="http://msdn2.microsoft.com/en-us/library/aa480453.aspx"&gt;http://msdn2.microsoft.com/en-us/library/aa480453.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   Enjoy...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=39dc1566-d318-4f47-b30c-9be4716d9087" /&gt;</description>
      <category>.NET 2005;Code</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=7eec6ba8-4399-49c8-8334-65c1e4c15940</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,7eec6ba8-4399-49c8-8334-65c1e4c15940.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello guys, how are you?
   </p>
        <p>
      In this post I wanted to talk about some code managing. As we all know (the Microsoft
      environment developers of course...) the 'natural' way, that Microsoft pushes into,
      that exists (if you are working with Visual Studio) is to work against Visual Source
      Safe. In all my (3 years) career progress I was working against this tool, which
      was not so bad, but in fact, it has some disadvantages and problems (do not mention
      the incidents of code losting and lack of doing merging between code files).
   </p>
        <p>
      So, let's talk about the <strong>SubVersion</strong> control system and give
      some overview about this open source and free product. 
      <br /><em>'The goal of the Subversion project is to build a <strong>version control system</strong> that
      is a compelling replacement for CVS in the open source community. The software is
      released under an </em><a href="http://subversion.tigris.org/license-1.html"><em>Apache/BSD-style</em></a><em> open
      source license.</em>' (taken from the SubVersion site).
   </p>
        <p>
      OK, some basics facts:
   </p>
        <ol>
          <li>
            <strong>FREE FREE FREE - </strong>As they claims (in the above paragraph) this product
         is free to use, so you don't need to buy this kind of a tool (if you are lack of money...
         :)) 
      </li>
          <li>
            <strong>Directories, renames, and file meta-data are versioned.</strong> Lack of these
         features is one of the most common complaints against each source control. Subversion
         versions not only file contents and file existence, but also directories, copies,
         and renames. It also allows arbitrary metadata ("properties") to be versioned along
         with any file or directory, and provides a mechanism for versioning the `execute'
         permission flag on files. 
      </li>
          <li>
            <strong>Apache network server option, with WebDAV/DeltaV protocol.</strong> Subversion
         can use the HTTP-based WebDAV/DeltaV protocol for network communications, and the
         Apache web server to provide repository-side network service. This gives Subversion
         an advantage over CVS in interoperability, and provides various key features for free:
         authentication, wire compression, and basic repository browsing. 
      </li>
        </ol>
        <p>
      and more...
   </p>
        <p>
      I found this tool best to use now, because in the existing project that I am
      working on, the work is also overseas (I am working commonly with developers
      in the US), and the only tool that provides that is the SubVersion.<br />
      Another good thing is that I can get as much as I want a file to work on, and even
      if another developer is working on it in the same time, at the end of the work
      SubVersion will know to merge the code in a smart way, which Visual Source Safe run
      into problems occasionally.
   </p>
        <p>
      So, if you want to explore some more details about it and download it you can go to
      the SubVersion site at: <a href="http://subversion.tigris.org/">http://subversion.tigris.org/</a></p>
        <p>
      Comments will be appriciated.
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=7eec6ba8-4399-49c8-8334-65c1e4c15940" />
      </body>
      <title>SubVersion control system... Good bye Visual Source Safe?</title>
      <guid>http://www.eranachum.com/PermaLink,guid,7eec6ba8-4399-49c8-8334-65c1e4c15940.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,7eec6ba8-4399-49c8-8334-65c1e4c15940.aspx</link>
      <pubDate>Mon, 19 Mar 2007 08:57:22 GMT</pubDate>
      <description>&lt;p&gt;
   Hello guys, how are you?
&lt;/p&gt;
&lt;p&gt;
   In this post I wanted to talk about some code managing. As we all know (the Microsoft
   environment developers of course...) the 'natural' way, that Microsoft pushes into,
   that exists (if you are working with Visual Studio) is to work against Visual Source
   Safe. In all my (3 years) career progress I was working&amp;nbsp;against this tool, which
   was not so bad, but in fact, it has&amp;nbsp;some disadvantages and problems (do not mention
   the incidents of code losting and lack of doing merging between code files).
&lt;/p&gt;
&lt;p&gt;
   So,&amp;nbsp;let's talk about the &lt;strong&gt;SubVersion&lt;/strong&gt; control system and give
   some overview about this open source and free product. 
   &lt;br&gt;
   &lt;em&gt;'The goal of the Subversion project is to build a &lt;strong&gt;version control system&lt;/strong&gt; that
   is a compelling replacement for CVS in the open source community. The software is
   released under an &lt;/em&gt;&lt;a href="http://subversion.tigris.org/license-1.html"&gt;&lt;em&gt;Apache/BSD-style&lt;/em&gt;&lt;/a&gt;&lt;em&gt; open
   source license.&lt;/em&gt;' (taken from the SubVersion site).
&lt;/p&gt;
&lt;p&gt;
   OK, some basics facts:
&lt;/p&gt;
&lt;ol&gt;
   &lt;li&gt;
      &lt;strong&gt;FREE FREE FREE - &lt;/strong&gt;As they claims (in the above paragraph) this product
      is free to use, so you don't need to buy this kind of a tool (if you are lack of money...
      :)) 
   &lt;li&gt;
      &lt;strong&gt;Directories, renames, and file meta-data are versioned.&lt;/strong&gt; Lack of these
      features is one of the most common complaints against each source control. Subversion
      versions not only file contents and file existence, but also directories, copies,
      and renames. It also allows arbitrary metadata ("properties") to be versioned along
      with any file or directory, and provides a mechanism for versioning the `execute'
      permission flag on files. 
   &lt;li&gt;
      &lt;strong&gt;Apache network server option, with WebDAV/DeltaV protocol.&lt;/strong&gt; Subversion
      can use the HTTP-based WebDAV/DeltaV protocol for network communications, and the
      Apache web server to provide repository-side network service. This gives Subversion
      an advantage over CVS in interoperability, and provides various key features for free:
      authentication, wire compression, and basic repository browsing. 
   &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
   and more...
&lt;/p&gt;
&lt;p&gt;
   I found this tool&amp;nbsp;best to use now, because in the existing project that I am
   working on, the work&amp;nbsp;is also overseas (I am working commonly with developers
   in the US), and the only&amp;nbsp;tool that provides that is the SubVersion.&lt;br&gt;
   Another good thing is that I can get as much as I want a file to work on, and even
   if&amp;nbsp;another developer is working on it in the same time, at the end of the work
   SubVersion will know to merge the code in a smart way, which Visual Source Safe run
   into problems occasionally.
&lt;/p&gt;
&lt;p&gt;
   So, if you want to explore some more details about it and download it you can go to
   the SubVersion site at: &lt;a href="http://subversion.tigris.org/"&gt;http://subversion.tigris.org/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   Comments will be appriciated.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=7eec6ba8-4399-49c8-8334-65c1e4c15940" /&gt;</description>
      <category>.NET 2005;Other</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=6d5e6323-3fb7-42ae-9368-76c65f0b24b0</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,6d5e6323-3fb7-42ae-9368-76c65f0b24b0.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello!
   </p>
        <p>
      Long time no seen, yes I know... 
      <br />
      It's because I am quite busy at work, we worked at full time job on a very large
      web project to one of the government offices, but this project is coming to its end.
   </p>
        <p>
      Now, to our issue...<br />
      Firstable some words about the application architecture - the application is
      devided and built as N-Tier layers, every tier is isolated from the other and lives
      as a single and separate assembly (.dll). 
      <br /><u><strong>The tiers are:</strong></u></p>
        <ul>
          <li>
            <strong>Entities Layer -</strong>  This layer holds and represents the entities
         of the application, for each database table there is an entity class which holds all
         its fields as properties by each field specification. This class is a Typed Dataset,
         that holds all the data and being generated automatically, in addition there is another
         class that represents a filter in purpose to hold values to filter if necessary. 
      </li>
          <li>
            <strong>Data Access Layer</strong> - Every entity class has a DAL class which implements
         the main CRUD (create, read, update and delete) methods against the database. For
         easyer and comfortable working, we are using the SqlHelper of Data Application Blocks
         v.2.0. 
      </li>
          <li>
            <strong>Business Logic Layer</strong> - This layer holds business logic classes that
         holds the flows of more comlpexed actions, like transactions, and a working with several
         tables. 
      </li>
          <li>
            <strong>Presentation Layer</strong> - This layer holds the presentation web pages.
         All the pages are AJAX fully supported to grant the user the best surfing experience.</li>
        </ul>
        <p>
      OK, after I told you about the architecture I will approach the problem I bumped into.
   </p>
        <p>
      When I wanted to fill my Typed DataSet using SqlHelper I thought to use the classic
      method:
   </p>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">UsersDS
      ds <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> SqlHelper.ExecuteDataset(con,
      CommandType.StoredProcedure, StoredProcedures.GetUserById, idParam);</span>
          </p>
        </span>
        <p>
      But I encountered with a problem to fill the typed DataSet - <strong>UsersDS</strong>, this
      method knows to return a generic DataSet with no specification of the Typed DataSet
      and it was a problem (but little one... :))
   </p>
        <p>
      The new change of the Data Application Blocks v.2.0 is that there is the ability
      of using <strong>FillDataSet</strong> method which knows to fill the exact Typed DataSet
      and DataTables that exists in it, and this is going like that:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">SqlHelper.FillDataset(con,
      StoredProcedures.GetUserById, ds, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span>[]
      { <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"E_Users"</span> },
      idParam);</span>
        </p>
        <p>
      Here, you must specify the Typed DataTable that exist in the Typed DataSet that you
      want to fill. As you see, we must send it via the method as a string's array, and
      by that you can send several tables to fill by sending their names.
   </p>
        <p>
      That's it folks, as usually I will be glad to hear some additions and comments.
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=6d5e6323-3fb7-42ae-9368-76c65f0b24b0" />
      </body>
      <title>Using Data Application Blocks v.2.0 with Typed DataSets</title>
      <guid>http://www.eranachum.com/PermaLink,guid,6d5e6323-3fb7-42ae-9368-76c65f0b24b0.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,6d5e6323-3fb7-42ae-9368-76c65f0b24b0.aspx</link>
      <pubDate>Thu, 15 Feb 2007 08:48:22 GMT</pubDate>
      <description>&lt;p&gt;
   Hello!
&lt;/p&gt;
&lt;p&gt;
   Long time no seen, yes I know... 
   &lt;br&gt;
   It's because I am quite busy at work, we worked&amp;nbsp;at full time job on a very large
   web project to one of the government offices, but this project is coming to its end.
&lt;/p&gt;
&lt;p&gt;
   Now, to our issue...&lt;br&gt;
   Firstable some words about the&amp;nbsp;application architecture - the application is
   devided and built as N-Tier layers, every tier is isolated from the other and lives
   as a single and separate assembly (.dll). 
   &lt;br&gt;
   &lt;u&gt;&lt;strong&gt;The tiers are:&lt;/strong&gt;&lt;/u&gt;
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;strong&gt;Entities Layer -&lt;/strong&gt;&amp;nbsp; This layer holds and represents the entities
      of the application, for each database table there is an entity class which holds all
      its fields as properties by each field specification. This class is a Typed Dataset,
      that holds all the data and being generated automatically, in addition there is another
      class that represents a filter in purpose to hold values to filter if necessary. 
   &lt;li&gt;
      &lt;strong&gt;Data Access Layer&lt;/strong&gt; - Every entity class has a DAL class which implements
      the main CRUD (create, read, update and delete) methods against the database. For
      easyer and comfortable working, we are using the SqlHelper of Data Application Blocks
      v.2.0. 
   &lt;li&gt;
      &lt;strong&gt;Business Logic Layer&lt;/strong&gt; - This layer holds business logic classes that
      holds the flows of more comlpexed actions, like transactions, and a working with several
      tables. 
   &lt;li&gt;
      &lt;strong&gt;Presentation Layer&lt;/strong&gt; - This layer holds the presentation web pages.
      All the pages are AJAX fully supported to grant the user the best surfing experience.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   OK, after I told you about the architecture I will approach the problem I bumped into.
&lt;/p&gt;
&lt;p&gt;
   When I wanted to fill my Typed DataSet using SqlHelper I thought to use the classic
   method:
&lt;/p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;UsersDS
   ds &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; SqlHelper.ExecuteDataset(con,
   CommandType.StoredProcedure, StoredProcedures.GetUserById, idParam);&lt;/span&gt;
&lt;/p&gt;
&lt;/span&gt; 
&lt;p&gt;
   But I encountered with a problem to fill the typed DataSet - &lt;strong&gt;UsersDS&lt;/strong&gt;,&amp;nbsp;this
   method knows to return a generic DataSet with no specification of the Typed DataSet
   and it was a problem (but little one... :))
&lt;/p&gt;
&lt;p&gt;
   The new change&amp;nbsp;of the Data Application Blocks v.2.0 is that there is the ability
   of using &lt;strong&gt;FillDataSet&lt;/strong&gt; method which knows to fill the exact Typed DataSet
   and DataTables that exists in it, and this is going like that:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;SqlHelper.FillDataset(con,
   StoredProcedures.GetUserById, ds, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt;[]
   { &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"E_Users"&lt;/span&gt; },
   idParam);&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Here, you must specify the Typed DataTable that exist in the Typed DataSet that you
   want to fill. As you see, we must send it via the method as a string's array, and
   by that you can send several tables to fill by sending their names.
&lt;/p&gt;
&lt;p&gt;
   That's it folks, as usually I will be glad to hear some additions and comments.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=6d5e6323-3fb7-42ae-9368-76c65f0b24b0" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=2b4804a9-111b-40b4-a8b5-b120a06646ac</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,2b4804a9-111b-40b4-a8b5-b120a06646ac.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Some of the impovments with that service pack are:
   </p>
        <p>
      1. <strong>Refactoring performance in ASP.NET WebSites projects like</strong>:<br />
          Before determining if an .aspx page should be loaded, the refactoring
      operation will: 
      <table class="list ul"><tbody><tr><td class="bullet">
                       <font size="2">•</font></td><td class="text"><font size="2">Perform a lexical search on the element that is being refactored to
                  determine if it exists in an .aspx page.</font></td></tr><tr><td class="bullet"><font size="2">      •</font></td><td class="text"><p><font size="2">Determine if a reference is accessible from the current scope.</font></p></td></tr></tbody></table></p>
        <p>
      2. <strong>Web Site Projects and Web Application Projects general issues</strong>:<br />
          The Web Applications project system does not detect missing web.config
      files. Adding a control that requires configuration information will cause a false
      folder to appear in Solution Explorer. The workaround is to add a web.config file
      manually before you add any controls to a Web Application project.<br /><br />
         Web Application projects that contain subprojects that reference
      controls in the root project may hang the IDE.<br /><br />
         If a Web site solution that contains .pdb and .xml files is added
      to TFS source control, the .pdb files and .xml files may not be added correctly.<br /><br />
         Visual Studio will leak memory when you operate a Wizard inside
      a View inside a Multiview. The workaround is to save the solution and then restart
      Visual Studio.<br /><br />
         Changes to the bin folder in Web site and Web Application projects
      can cause Visual Studio to create a shadow copy of the entire bin folder. This copying
      can slow the performance of Visual Studio and consume disk space.<br /><br />
         If your page and user controls exist in different namespaces that
      are under the same root namespace, the generated code will not compile because the
      namespace that the designer creates for the declaration of the user control inside
      the page is wrong. The workaround is to delete the declaration from the designer file
      and then put it in the code-behind file. Once it is moved to the code-behind file,
      it will remain there unaltered even if you change the page.<br /></p>
        <p>
      You can download it by pressing this link: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&amp;displaylang=en</a></p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=2b4804a9-111b-40b4-a8b5-b120a06646ac" />
      </body>
      <title>Visual Studion 2005 Service Pack 1 is ready to download...</title>
      <guid>http://www.eranachum.com/PermaLink,guid,2b4804a9-111b-40b4-a8b5-b120a06646ac.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,2b4804a9-111b-40b4-a8b5-b120a06646ac.aspx</link>
      <pubDate>Thu, 28 Dec 2006 10:29:42 GMT</pubDate>
      <description>&lt;p&gt;
   Some of the impovments with that service pack are:
&lt;/p&gt;
&lt;p&gt;
   1. &lt;strong&gt;Refactoring performance in ASP.NET WebSites projects like&lt;/strong&gt;:&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; Before determining if an .aspx page should be loaded, the refactoring
   operation will: 
   &lt;table class="list ul"&gt;
      &lt;tbody&gt;
         &lt;tr&gt;
            &lt;td class=bullet&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font size=2&gt;•&lt;/font&gt;&lt;/td&gt;
            &lt;td class=text&gt;
               &lt;font size=2&gt;Perform a lexical search on the element that is being refactored to determine
               if it exists in an .aspx page.&lt;/font&gt;&lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
            &lt;td class=bullet&gt;
               &lt;font size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;•&lt;/font&gt;&lt;/td&gt;
            &lt;td class=text&gt;
               &lt;p&gt;
                  &lt;font size=2&gt;Determine if a reference is accessible from the current scope.&lt;/font&gt;
               &lt;/p&gt;
            &lt;/td&gt;
         &lt;/tr&gt;
      &lt;/tbody&gt;
   &lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;
   2. &lt;strong&gt;Web Site Projects and Web Application Projects general issues&lt;/strong&gt;:&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; The Web Applications project system does not detect missing web.config
   files. Adding a control that requires configuration information will cause a false
   folder to appear in Solution Explorer. The workaround is to add a web.config file
   manually before you add any controls to a Web Application project.&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Web Application projects that contain subprojects that reference
   controls in the root project may hang the IDE.&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;If a Web site solution that contains .pdb and .xml files is added
   to TFS source control, the .pdb files and .xml files may not be added correctly.&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Visual Studio will leak memory when you operate a Wizard inside
   a View inside a Multiview. The workaround is to save the solution and then restart
   Visual Studio.&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Changes to the bin folder in Web site and Web Application projects
   can cause Visual Studio to create a shadow copy of the entire bin folder. This copying
   can slow the performance of Visual Studio and consume disk space.&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;If your page and user controls exist in different namespaces that
   are under the same root namespace, the generated code will not compile because the
   namespace that the designer creates for the declaration of the user control inside
   the page is wrong. The workaround is to delete the declaration from the designer file
   and then put it in the code-behind file. Once it is moved to the code-behind file,
   it will remain there unaltered even if you change the page.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
   You can download it by pressing this link: &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&amp;amp;displaylang=en&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=2b4804a9-111b-40b4-a8b5-b120a06646ac" /&gt;</description>
      <category>.NET 2005;System</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=3bc530eb-3fcf-4c49-8a84-1c79fb265b9b</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,3bc530eb-3fcf-4c49-8a84-1c79fb265b9b.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hey guys how are you?
   </p>
        <p>
      After long conversation with my work colleague, I thought that I need to sharpen the
      evidences about <strong>Application Domains - </strong>aka <strong>AppDomain.</strong></p>
        <p>
      By .NET environment, the concept of an application domain, or AppDomain known as a
      process. The AppDomain is both a container and a boundary. The .NET runtime uses an
      AppDomain as a container for code and data, just like the operating system uses a
      process as a container for code and data. As the operating system uses a process
      to isolate misbehaving code, the .NET runtime uses an AppDomain to isolate code inside
      of a secure boundary. 
   </p>
        <p>
      An AppDomain belongs to only a single process, but single process can hold multiple
      AppDomains. An AppDomain is relatively cheap to create (compared to a process), and
      has relatively less overhead to maintain than a process. For these reasons, an AppDomain
      is a great solution for the ISP who is hosting hundreds of applications. Each application
      can exist inside an isolated AppDomain, and many of these AppDomains can exist inside
      of a single process – a cost savings.
   </p>
        <p>
      Lets take an example from the <strong>REAL </strong>life:<br />
      Assume that you had created 2 ASP.NET aplpications in the same server, what will happen
      intior the system?
   </p>
        <p>
      Firstable, the ASP.NET process that runs the web application will run both the applications
      (you can find the process name in the task manager as <strong>aspnet_wp.exe</strong> in
      Windows XP or as <strong>w3wp.exe</strong> in Windows 2003. Each application
      will have its own AppDomain including its Cache, Application, and Session objects.<br />
      BUT, the code of the same application runs under the same process!
   </p>
        <p>
          <strong>What about static members or shared classes? </strong>In this case, each ApDomain
      will have its own copy of the static members (fields), but of course, the data and
      code is not shared and will be held safely isolated and inside of a boundary provided
      by the AppDomain.
   </p>
        <p>
          <strong>Load some new assemblies..<br /></strong>Suppose you want to load an updated dll into the application folder or subdirectory,
      the ASP.NET runtime will recognize it and and will start a new AppDomain because it
      cannot insert it to the running AppDomain, the result is that running requests will
      finish its work and after it they will work against the new AppDomain that holds the
      new dll and executing code.
   </p>
        <p>
          <strong>Last word...<br /></strong>I think that one of the good adventages of the AppDomain is that you can
      allocate the wanted memory for your application (under its AppDomain) as much
      as you want (bounded by the process capability of course) and if there is a runtime
      crash, the rest of the applciations that runs over the current process will not crash.
   </p>
        <p>
      I will glad to hear some comments and additions... :)
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=3bc530eb-3fcf-4c49-8a84-1c79fb265b9b" />
      </body>
      <title>Lets talk about Application Domains</title>
      <guid>http://www.eranachum.com/PermaLink,guid,3bc530eb-3fcf-4c49-8a84-1c79fb265b9b.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,3bc530eb-3fcf-4c49-8a84-1c79fb265b9b.aspx</link>
      <pubDate>Thu, 23 Nov 2006 13:03:00 GMT</pubDate>
      <description>&lt;p&gt;
   Hey guys how are you?
&lt;/p&gt;
&lt;p&gt;
   After long conversation with my work colleague, I thought that I need to sharpen the
   evidences about &lt;strong&gt;Application Domains - &lt;/strong&gt;aka &lt;strong&gt;AppDomain.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   By .NET environment, the concept of an application domain, or AppDomain known as a
   process. The AppDomain is both a container and a boundary. The .NET runtime uses an
   AppDomain as a container for code and data, just like the operating system uses a
   process as a container for code and data.&amp;nbsp;As the operating system uses a process
   to isolate misbehaving code, the .NET runtime uses an AppDomain to isolate code inside
   of a secure boundary. 
&lt;/p&gt;
&lt;p&gt;
   An AppDomain belongs to only a single process, but single process can hold multiple
   AppDomains. An AppDomain is relatively cheap to create (compared to a process), and
   has relatively less overhead to maintain than a process. For these reasons, an AppDomain
   is a great solution for the ISP who is hosting hundreds of applications. Each application
   can exist inside an isolated AppDomain, and many of these AppDomains can exist inside
   of a single process – a cost savings.
&lt;/p&gt;
&lt;p&gt;
   Lets take an example from the &lt;strong&gt;REAL &lt;/strong&gt;life:&lt;br&gt;
   Assume that you had created 2 ASP.NET aplpications in the same server, what will happen
   intior the system?
&lt;/p&gt;
&lt;p&gt;
   Firstable, the ASP.NET process that runs the web application will run both the applications
   (you can find the process name in the task manager as &lt;strong&gt;aspnet_wp.exe&lt;/strong&gt; in
   Windows XP or as &lt;strong&gt;w3wp.exe&lt;/strong&gt;&amp;nbsp;in Windows 2003. Each application
   will have its own AppDomain including its Cache, Application, and Session objects.&lt;br&gt;
   BUT, the code of the same application runs under the same process!
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;What about static members or shared classes? &lt;/strong&gt;In this case, each ApDomain
   will have its own copy of the static members (fields), but of course, the data and
   code is not shared and will be held safely isolated and inside of a boundary provided
   by the AppDomain.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Load some new&amp;nbsp;assemblies..&lt;br&gt;
   &lt;/strong&gt;Suppose you want to load an updated dll into the application folder or subdirectory,
   the ASP.NET runtime will recognize it and and will start a new AppDomain because it
   cannot insert it to the running AppDomain, the result is that running requests will
   finish its work and after it they will work against the new AppDomain that holds the
   new dll and executing code.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Last word...&lt;br&gt;
   &lt;/strong&gt;I think that one of the good adventages of the AppDomain is that you can
   allocate the wanted memory for your application (under its AppDomain)&amp;nbsp;as much
   as you want (bounded by the process capability of course) and if there is a runtime
   crash, the rest of the applciations that runs over the current process will not crash.
&lt;/p&gt;
&lt;p&gt;
   I will glad to hear some comments and additions... :)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=3bc530eb-3fcf-4c49-8a84-1c79fb265b9b" /&gt;</description>
      <category>.NET 2005;Security;System</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=9321cf9f-8bf2-4eb2-8b4b-1df0ef24049b</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,9321cf9f-8bf2-4eb2-8b4b-1df0ef24049b.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hey guys, how are you these hot and exhausting days?? I am pretty OK, except for the
      heat...
   </p>
        <p>
      If you didn't hear about the <strong>ReSharper </strong>yet, some words about it: 
      <br /><strong>ReSharper </strong>is an add-on to Visual Studio 2003 and 2005, It comes equipped
      with a rich set of features that greatly increase the productivity of C# and ASP.NET
      developers. With ReSharper you get intelligent coding assistance, on-the-fly error
      highlighting and quick error correction, as well as unmatched support for code refactoring,
      unit testing, and a whole lot more. All of ReSharper's advanced features are available
      right from Visual Studio. 
   </p>
        <p>
      This add-on includes features like: Error Highlighting and Quick-Fixes, Advanced Coding
      Assistance, Numerous Refactorings, Navigation and Search, Unit Testing, ASP.NET Editing,
      NAnt and MS Build Scripts Editing. More details you could read in the link attached
      below.
   </p>
        <p>
      So, you can try using this good add-on by downloading a 30-day evaluation from the <strong><em>jetbrains.com </em></strong>site <a href="http://www.jetbrains.com/resharper/index.html" target="_blank">here</a>,
      and if you will like it I suggest to buy it (on your company account of course :))
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=9321cf9f-8bf2-4eb2-8b4b-1df0ef24049b" />
      </body>
      <title>R# ReSharper 2.0 is ready to download...</title>
      <guid>http://www.eranachum.com/PermaLink,guid,9321cf9f-8bf2-4eb2-8b4b-1df0ef24049b.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,9321cf9f-8bf2-4eb2-8b4b-1df0ef24049b.aspx</link>
      <pubDate>Thu, 24 Aug 2006 07:21:38 GMT</pubDate>
      <description>&lt;p&gt;
   Hey guys, how are you these hot and exhausting days?? I am pretty OK, except for the
   heat...
&lt;/p&gt;
&lt;p&gt;
   If you didn't hear about the &lt;strong&gt;ReSharper &lt;/strong&gt;yet, some words about it: 
   &lt;br&gt;
   &lt;strong&gt;ReSharper &lt;/strong&gt;is an add-on to Visual Studio 2003 and 2005, It comes equipped
   with a rich set of features that greatly increase the productivity of C# and ASP.NET
   developers. With ReSharper you get intelligent coding assistance, on-the-fly error
   highlighting and quick error correction, as well as unmatched support for code refactoring,
   unit testing, and a whole lot more. All of ReSharper's advanced features are available
   right from Visual Studio. 
&lt;/p&gt;
&lt;p&gt;
   This add-on includes features like: Error Highlighting and Quick-Fixes, Advanced Coding
   Assistance, Numerous Refactorings, Navigation and Search, Unit Testing, ASP.NET Editing,
   NAnt and MS Build Scripts Editing. More details you could read in the link attached
   below.
&lt;/p&gt;
&lt;p&gt;
   So, you can try using this good add-on by downloading a 30-day evaluation from the &lt;strong&gt;&lt;em&gt;jetbrains.com &lt;/em&gt;&lt;/strong&gt;site &lt;a href="http://www.jetbrains.com/resharper/index.html" target=_blank&gt;here&lt;/a&gt;,
   and if you will like it I suggest to buy it (on your company account of course :))
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=9321cf9f-8bf2-4eb2-8b4b-1df0ef24049b" /&gt;</description>
      <category>.NET 2005;Other</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=5ceb6fbf-c661-49df-a6a8-269fbf094cd8</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,5ceb6fbf-c661-49df-a6a8-269fbf094cd8.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello!
   </p>
        <p>
      Yesterday while surfing on the web in purpose to find some interesting tutorials and
      innovations, I encountered with a nice article that has been written by my college's
      mate, Evyatar Ben-Shitrit. 
   </p>
        <p>
      This control derives from ListBox, supports a horizontal scroll bar, and yet behaves
      like the ASP.NET ListBox control. More in this article, he explains the creation of
      the ScrollableListBox custom control (written by him).
   </p>
        <p>
      So, I recommend reading this one at <em><strong>thecodeproject</strong></em> web site <a href="http://www.codeproject.com/aspnet/ScrollableListBoxASP20.asp?msg=1633763&amp;vb=56#xx1633763xx" target="_blank">here</a>.
   </p>
        <p>
      Fare well...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=5ceb6fbf-c661-49df-a6a8-269fbf094cd8" />
      </body>
      <title>A nice article about a ScrollableListBox Custom Control for ASP.NET 2.0</title>
      <guid>http://www.eranachum.com/PermaLink,guid,5ceb6fbf-c661-49df-a6a8-269fbf094cd8.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,5ceb6fbf-c661-49df-a6a8-269fbf094cd8.aspx</link>
      <pubDate>Mon, 21 Aug 2006 12:31:30 GMT</pubDate>
      <description>&lt;p&gt;
   Hello!
&lt;/p&gt;
&lt;p&gt;
   Yesterday while surfing on the web in purpose to find some interesting tutorials and
   innovations, I encountered with a nice article that has been written by&amp;nbsp;my college's
   mate, Evyatar Ben-Shitrit. 
&lt;/p&gt;
&lt;p&gt;
   This control derives from ListBox, supports a horizontal scroll bar, and yet behaves
   like the ASP.NET ListBox control. More in this article, he explains the creation of
   the ScrollableListBox custom control (written by him).
&lt;/p&gt;
&lt;p&gt;
   So, I recommend reading this one at &lt;em&gt;&lt;strong&gt;thecodeproject&lt;/strong&gt;&lt;/em&gt; web site &lt;a href="http://www.codeproject.com/aspnet/ScrollableListBoxASP20.asp?msg=1633763&amp;amp;vb=56#xx1633763xx" target=_blank&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   Fare well...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=5ceb6fbf-c661-49df-a6a8-269fbf094cd8" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=497363e1-aac9-4a88-a3fd-ff1d817fcfa5</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,497363e1-aac9-4a88-a3fd-ff1d817fcfa5.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello!
   </p>
        <p>
      I am still working on a big web application in work. I will glad to tell you about
      the application, but this is for other conversation. I am glad to say that we are
      close to the end of the project and doing now last fine tuning on it.
   </p>
        <p>
      The thing that I had to deal with for the last days is all the issue with publishing
      application errors in orderly fashion to the event viewer. The reason of doing it
      is to get the ability of tracking in runtime, bugs, errors or exceptions that can
      be appear while the application is in production. In this case we don't have
      the CLR debugger to find what was wrong (if something happend of course...), so we
      must publish the exception to the system's event viewer or just  to
      a simple Log file (which less recommended then publishing to the system's event viewer).
   </p>
        <p>
      Now, to the implementation (the imporatnt thing!!!)
   </p>
        <p>
      In order to publish error to the event viewer, we need to use the <strong>Microsoft.ApplicationBlocks.ExceptionManagement </strong>assembly
      of Microsoft. This assembly expose us all the publishing tools that we will need to
      publish an errors (and more...).
   </p>
        <p>
      In my web application, in global.asax file, in Application_Error method, I wanted
      to publish the exception to the event viewer. It is very important to do it there,
      because in every application error, like runtime errors, exceptions and actions that
      the application and systme doesn't know to deal with, this method is being called
      (by the application of course).
   </p>
        <p>
      Now, before publishing the error to the event viewer, you need to distinguish between
      the different exceptions. Do it with your own information about every exception that
      is happening <u>but</u>, it is important to know that also in every response's redirect
      (Response.Redirect (" ... ", true) or server's transfer (Server.Transfer (" ...
      ", true) an ThreadAbortException is being raised.
   </p>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Exception
      lastError <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Server.GetLastError();<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (Server.GetLastError() <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">is</span> ThreadAbortException
      || lastError.InnerException <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">is</span> ThreadAbortException)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Eat the exception - caused by Response.Redirect(..., true) or Server.Transfer(...,
      true).</span><br />
         Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(lastError.GetBaseException());<br />
         Server.ClearError();<br />
      }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span><br />
      {<br />
         Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(lastError.GetBaseException());<br />
         Server.ClearError();<br />
         Server.Transfer(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"~/Error.aspx"</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">false</span>);<br />
      }</span>
          </p>
        </span>
        <p>
      By this example you can see the publish exceptions handling.
   </p>
        <p>
      Now, do not forget to declare in the web.config file the appliation name and the exceptions
      pulishing handling:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">&lt;exceptionManagement
      mode=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"on"</span>&gt;<br />
              &lt;publisher assembly=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Microsoft.ApplicationBlocks.ExceptionManagement"</span> type=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher"</span> applicationname=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"APPLICATION_NAME"</span>/&gt;<br />
      &lt;/exceptionManagement&gt;</span>
        </p>
        <p>
      One more thing... you need to register this assembly with the appliation name in
      the registry in purpose to let the application all the rights to publish
      the error in the event viewer, if you won't do it, the system won't let you write
      to the event viewer and you will get the exception: <strong>The event source ExceptionManagerInternalException
      does not exist and cannot be created with the current permissions. security exception </strong>and
      you will spend planty of time trying to solve it :) (like me...)
   </p>
        <p>
      How to register this to the registry you ask?
   </p>
        <p>
      Open notepad and write there this code:
   </p>
        <p>
          <em>Windows Registry Editor Version 5.00</em>
        </p>
        <p>
          <em>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\APPLICATION_NAME]<br />
      "EventMessageFile"="C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\EventLogMessages.dll"</em>
        </p>
        <p>
      Save this file with <strong>.reg </strong>extension and double click on it, this will
      register this to the system's registry.
   </p>
        <p>
      So, bye for now...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=497363e1-aac9-4a88-a3fd-ff1d817fcfa5" />
      </body>
      <title>How to publish application errors to the System's Event Viewer</title>
      <guid>http://www.eranachum.com/PermaLink,guid,497363e1-aac9-4a88-a3fd-ff1d817fcfa5.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,497363e1-aac9-4a88-a3fd-ff1d817fcfa5.aspx</link>
      <pubDate>Wed, 02 Aug 2006 05:47:28 GMT</pubDate>
      <description>&lt;p&gt;
   Hello!
&lt;/p&gt;
&lt;p&gt;
   I am still working on a big web application in work. I will glad to tell you about
   the application, but this is for other conversation. I am glad to say that we are
   close to the end of the project and doing now last fine tuning on it.
&lt;/p&gt;
&lt;p&gt;
   The&amp;nbsp;thing that I had to deal with for the last days is all the issue with publishing
   application errors in orderly fashion to the event viewer. The reason of doing it
   is to get the ability of tracking in&amp;nbsp;runtime, bugs, errors or exceptions&amp;nbsp;that&amp;nbsp;can
   be appear while the application is in production. In this case&amp;nbsp;we don't have
   the CLR debugger to find what was wrong (if something happend of course...), so we
   must publish&amp;nbsp;the exception&amp;nbsp;to the system's event viewer or just&amp;nbsp; to
   a simple Log file (which less recommended then publishing to the system's event viewer).
&lt;/p&gt;
&lt;p&gt;
   Now, to the implementation (the imporatnt thing!!!)
&lt;/p&gt;
&lt;p&gt;
   In order to publish error to the event viewer, we need to use the &lt;strong&gt;Microsoft.ApplicationBlocks.ExceptionManagement &lt;/strong&gt;assembly
   of Microsoft. This assembly expose us all the publishing tools that we will need to
   publish an errors (and more...).
&lt;/p&gt;
&lt;p&gt;
   In my web application, in global.asax file, in Application_Error method, I wanted
   to publish the exception to the event viewer. It is very important to do it there,
   because in every application error, like runtime errors, exceptions and actions that
   the application and systme doesn't know to deal with, this method is being called
   (by the application of course).
&lt;/p&gt;
&lt;p&gt;
   Now, before publishing the error to the event viewer, you need to distinguish between
   the different exceptions. Do it with your own information about every exception that
   is happening &lt;u&gt;but&lt;/u&gt;, it is important to know that also in every response's redirect
   (Response.Redirect (" ... ", true)&amp;nbsp;or server's transfer (Server.Transfer (" ...
   ", true) an ThreadAbortException is being raised.
&lt;/p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Exception
   lastError &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Server.GetLastError();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (Server.GetLastError() &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;is&lt;/span&gt; ThreadAbortException
   || lastError.InnerException &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;is&lt;/span&gt; ThreadAbortException)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Eat the exception - caused by Response.Redirect(..., true) or Server.Transfer(...,
   true).&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(lastError.GetBaseException());&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Server.ClearError();&lt;br&gt;
   }&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt;
   &lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(lastError.GetBaseException());&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Server.ClearError();&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;Server.Transfer(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"~/Error.aspx"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/span&gt;);&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;/span&gt; 
&lt;p&gt;
   By this example you can see the publish exceptions handling.
&lt;/p&gt;
&lt;p&gt;
   Now, do not forget to declare in the web.config file the appliation name and the exceptions
   pulishing handling:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;lt;exceptionManagement
   mode=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"on"&lt;/span&gt;&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;publisher assembly=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Microsoft.ApplicationBlocks.ExceptionManagement"&lt;/span&gt; type=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher"&lt;/span&gt;&amp;nbsp;applicationname=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"APPLICATION_NAME"&lt;/span&gt;/&amp;gt;&lt;br&gt;
   &amp;lt;/exceptionManagement&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   One more thing... you need to register this assembly with&amp;nbsp;the appliation name&amp;nbsp;in
   the registry&amp;nbsp;in&amp;nbsp;purpose to let the application all the rights to publish
   the error in the event viewer, if you won't do it, the system won't let you write
   to the event viewer and you will get the exception: &lt;strong&gt;The event source ExceptionManagerInternalException
   does not exist and cannot be created with the current permissions. security exception &lt;/strong&gt;and
   you will spend planty of time trying to solve it :) (like me...)
&lt;/p&gt;
&lt;p&gt;
   How to register this to the registry you ask?
&lt;/p&gt;
&lt;p&gt;
   Open notepad and write there this code:
&lt;/p&gt;
&lt;p&gt;
   &lt;em&gt;Windows Registry Editor Version 5.00&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;em&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\APPLICATION_NAME]&lt;br&gt;
   "EventMessageFile"="C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\EventLogMessages.dll"&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
   Save this file with &lt;strong&gt;.reg &lt;/strong&gt;extension and double click on it, this will
   register this to the system's registry.
&lt;/p&gt;
&lt;p&gt;
   So, bye for now...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=497363e1-aac9-4a88-a3fd-ff1d817fcfa5" /&gt;</description>
      <category>.NET 2005;System</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=c0252ff4-09e0-4681-b6fc-5aaed43daafc</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,c0252ff4-09e0-4681-b6fc-5aaed43daafc.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Didn't I tell you that I love .Net 2.0? If I didn't I am saying it now...<br /><br />
      This is new a method in .NET 2.0, but who plays with it should know it by now.
      Instead of working hard trying to sort a collection (or a list which is a descendant
      of it) of some entities, now you have the <strong>Sort</strong> method, which
      does it for FREE and in better performence.<br />
      Any case I decided to show a simple example to whom that doesn't know it or just want
      to be impressed again from it.<br /><font size="1"></font></p>
        <p>
          <font size="1">* Comment: I assumes in this post that you are familier with Generics
      and delegates.</font>
        </p>
        <p>
      Let's assume that you have an entity structured like:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span> struct
      Entity<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> _id;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> _name;<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      and more...</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> Id<br />
         {<br />
            get{<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span> _id;}<br />
            set{_id <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;}<br />
         }<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> Name<br />
         {<br />
            get{<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span> _name;}<br />
            set{_name <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;}<br />
         }<br />
      }</span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">Now,
      suppose you have a list of these entities and you want to sort it by their name and
      display it sorted. Follow the example code below and see how it easy using anonymous
      delegate:</font>
          </span>
        </p>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//sortDirecion
      is a global variable that determines the sort direction</span>
              <br />
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span> sortParam <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> sortDirection
      == <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Ascending"</span> ?
      1 : -1;<br /><br />
      entitiesList.Sort(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Comparison&lt;Entity&gt;(<br /></span>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   delegate</span>(Entity
      e1, Entity e2)<br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      return</span> sortParam <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">*</span> e1.Name.CompareTo(e2.Name);<br />
         })<br />
      };</span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">Nice
      &amp; easy that's it (with no sofisticated actions).</font>
            </span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">Some
      more tutorials about anonymous delegates (or delegates in general) you can find in
      Oren Elenbogen's (a team leader in my department) blog <a href="http://www.lnbogen.com/SlidesDemosFromMyCodeTemplatingPresentation.aspx" target="_blank">here</a>.</font>
            </span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">So,
      be well.<br />
      p.s. Again... I will be glad to head some comment or sharpening.</font>
            </span>
          </p>
        </span>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=c0252ff4-09e0-4681-b6fc-5aaed43daafc" />
      </body>
      <title>Sort System.Collections.Generic.List&lt;T&gt; with anonymous delegate</title>
      <guid>http://www.eranachum.com/PermaLink,guid,c0252ff4-09e0-4681-b6fc-5aaed43daafc.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,c0252ff4-09e0-4681-b6fc-5aaed43daafc.aspx</link>
      <pubDate>Tue, 11 Jul 2006 07:19:32 GMT</pubDate>
      <description>&lt;p&gt;
   Didn't I tell you that I love .Net 2.0? If I didn't I am saying it now...&lt;br&gt;
   &lt;br&gt;
   This is new a&amp;nbsp;method in .NET 2.0, but who plays with it should know it by now.
   Instead of working hard trying to sort a&amp;nbsp;collection (or a list which is a descendant
   of it)&amp;nbsp;of some entities, now you have the &lt;strong&gt;Sort&lt;/strong&gt; method, which
   does it for FREE and in better performence.&lt;br&gt;
   Any case I decided to show a simple example to whom that doesn't know it or just want
   to be impressed again from it.&lt;br&gt;
   &lt;font size=1&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font size=1&gt;* Comment: I assumes in this post that you are familier with Generics
   and delegates.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   Let's assume that you have an entity&amp;nbsp;structured like:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; struct
   Entity&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt; _id;&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; _name;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   and more...&lt;/span&gt;
   &lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt; Id&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get{&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; _id;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set{_id &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; Name&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get{&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; _name;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set{_name &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Now,
   suppose you have a list of these entities and you want to sort it by their name and
   display it sorted. Follow the example code below and see how it easy using anonymous
   delegate:&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//sortDirecion
   is a global variable that determines the sort direction&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt; sortParam &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; sortDirection
   == &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Ascending"&lt;/span&gt; ?
   1 : -1;&lt;br&gt;
   &lt;br&gt;
   entitiesList.Sort(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Comparison&amp;lt;Entity&amp;gt;(&lt;br&gt;
   &lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;delegate&lt;/span&gt;(Entity
   e1, Entity e2)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/span&gt; sortParam &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;*&lt;/span&gt; e1.Name.CompareTo(e2.Name);&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;})&lt;br&gt;
   };&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Nice
   &amp;amp; easy that's it (with no sofisticated actions).&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Some
   more tutorials about anonymous delegates (or delegates in general) you can find in
   Oren Elenbogen's (a team leader in my department)&amp;nbsp;blog &lt;a href="http://www.lnbogen.com/SlidesDemosFromMyCodeTemplatingPresentation.aspx" target=_blank&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;So,
   be well.&lt;br&gt;
   p.s. Again... I will be glad to head some comment or sharpening.&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/span&gt;&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=c0252ff4-09e0-4681-b6fc-5aaed43daafc" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=99151577-4cde-417e-a371-d72f38fa27f4</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,99151577-4cde-417e-a371-d72f38fa27f4.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello!
   </p>
        <p>
      Long time no posted new post to the blog regarding the hard work on Tigers project
      at work, but while programming and programming, I encoutered with new asp.net 2.0
      Page property that called <strong>Previous Page.<br /></strong>This property holds all the web controls with its data and infromation of
      the previous page of the current page that you are in.
   </p>
        <p>
      I found this property very useful and it can do you 'Easy Life' while getting data
      from the previous page that you came from (or the user that uses your application).
   </p>
        <p>
      For example: suppose you want to use specific information from the page that you are
      just have been redirected from, like search term text. In the 'old fasioned' way,
      you needed to save this data in the Session variable or to send it by the query string
      of the url address and it will be expose to everyone, but PreviousPage property comes
      to avoid this ways by saving all the previous page data by looking for the specific
      control that holds the data, For example:
   </p>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <p>
                <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
                  <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (Page.PreviousPage
      !<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   if</span> (Page.PreviousPage.FindControl(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"txtSearchTerm"</span>)
      !<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)<br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      string</span> term <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> ((TextBox)Page.PreviousPage.FindControl(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"txtSearchTerm"</span>)).Text;<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      //do
      your thing with this data...</span><br />
         }<br />
      }</span>
              </p>
            </span>
          </span>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">Here
      I checked if there is a previous page and if it contains the txtSearchTerm Textbox
      controls, grab its data and use it.</font>
            </span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">Is
      it nice or not?</font>
            </span>
          </p>
        </span>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=99151577-4cde-417e-a371-d72f38fa27f4" />
      </body>
      <title>Page.PreviousPage, a New &amp; Nice asp.net 2.0 feature (property)</title>
      <guid>http://www.eranachum.com/PermaLink,guid,99151577-4cde-417e-a371-d72f38fa27f4.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,99151577-4cde-417e-a371-d72f38fa27f4.aspx</link>
      <pubDate>Thu, 29 Jun 2006 17:38:26 GMT</pubDate>
      <description>&lt;p&gt;
   Hello!
&lt;/p&gt;
&lt;p&gt;
   Long time no posted new post to the blog regarding the hard work on Tigers project
   at work, but while programming and programming, I encoutered with new asp.net 2.0
   Page property that called &lt;strong&gt;Previous Page.&lt;br&gt;
   &lt;/strong&gt;This property holds all the web controls with its data and infromation of
   the previous page of the current page that you are in.
&lt;/p&gt;
&lt;p&gt;
   I found this property very useful and it can do you 'Easy Life' while getting data
   from the previous page that you came from (or the user that uses your application).
&lt;/p&gt;
&lt;p&gt;
   For example: suppose you want to use specific information from the page that you are
   just have been redirected from, like search term text. In the 'old fasioned'&amp;nbsp;way,
   you needed to save this data in the Session variable or to send it by the query string
   of the url address and it will be expose to everyone, but PreviousPage property comes
   to avoid this ways by saving all the previous page data by looking for the specific
   control that holds the data, For example:
&lt;/p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (Page.PreviousPage
   !&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/span&gt; (Page.PreviousPage.FindControl(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"txtSearchTerm"&lt;/span&gt;)
   !&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string&lt;/span&gt; term &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; ((TextBox)Page.PreviousPage.FindControl(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"txtSearchTerm"&lt;/span&gt;)).Text;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//do
   your thing with this data...&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Here
   I checked if there is a previous page and if it contains the txtSearchTerm Textbox
   controls, grab its data and use it.&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Is
   it nice or not?&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/span&gt;&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=99151577-4cde-417e-a371-d72f38fa27f4" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=6e26a414-6a87-47a6-b9c0-e3be26298852</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,6e26a414-6a87-47a6-b9c0-e3be26298852.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hey all!
   </p>
        <p>
      While developing the Data Access Layer (DAL) in my "home developing" project - <a href="http://www.haverut.co.il/" target="_blank"><strong>Haverut.co.il</strong></a> I
      deliberated wheather to use the old fashioned way - the Application Blocks of Microsoft,
      which I need to implement all the database contact by hand and use the 'jacket'
      of the Application Blocks adapters <strong>OR</strong> to use Typed datasets... 
      <br />
      I decided to use the second choice, because (as knows) this module knows to generate
      code of database tables and to create by default the main CRUD (Create, Read,
      Update and Delete) methods and also custom SQL queries.
   </p>
        <p>
      But this is not the main issue of this post... 
   </p>
        <p>
      While working, I needed to do several connected commands against the database, therefore
      I needed to use the Transaction term to knot these commands and to avoid database's
      commands failure or 'half-way actions'.
   </p>
        <p>
      Now, the biggest deliberation: To use <strong>SQLTransction</strong> module or <strong>TransactionScope</strong> module (which
      is new module that cane out in .NET 2.0)?
   </p>
        <p>
      In the first thought I decided to use <strong>TransactionScope</strong>, because it's
      very easy to use and it doesn't make "pain in the neck". The usage it easy: you need
      to wrap the wanted scope with this module and all the job will be done safely under
      this transaction.<br />
      further documentation you can find here:
   </p>
        <ul>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/system.transactions.transactionscope.aspx">http://msdn2.microsoft.com/en-us/library/system.transactions.transactionscope.aspx</a>
          </li>
          <li>
            <a href="http://msdn2.microsoft.com/en-us/library/ms172152.aspx">http://msdn2.microsoft.com/en-us/library/ms172152.aspx</a>
          </li>
        </ul>
        <p>
      But this module holds not much of disadvantages like: 
   </p>
        <ul>
          <li>
         Low performence of this action in the application, in large amount of users and actions
         the performance of this actions will be very bad and slow. 
      </li>
          <li>
         By default, when using this module, the system tries to look for a transaction that
         is otherwise current, or a <b>TransactionScope</b> object that dictates that <strong>Current </strong>(a
         static property of this namespace) is <strong>null. </strong>If it cannot find
         either one of these, <strong>System.Transactions</strong> queries the COM+ context
         for a transaction. Note that even though <strong>System.Transactions</strong> may
         find a transaction from the COM+ context, it still favors transactions that are native
         to <strong>System.Transactions</strong>. This thing is not recommended because we
         need to handle the COM+ context in addition to our application context. More info
         you can find <strong><a href="http://msdn2.microsoft.com/en-us/library/ms229974.aspx" target="_blank">here.</a></strong></li>
        </ul>
        <p>
      Because of that, I decided to use <strong>SQLTransaction</strong>s over my Typed Datasets'
      actions.
   </p>
        <p>
      To do this in appropriate way, I used a <u>partial class</u> (very nice innovation
      in .NET 2.0) with the same name of the Typed DS class, to 'continue' its code and
      overload some of the members like the main member that does the connection with
      the database: <strong>_adapter.<br /></strong>This member is private and is not accessible to outside requests. 
   </p>
        <p>
      Instead of a BeginTransaction method, I have implemented a Transaction property on
      my TableAdapters, like this:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">partial <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> CitiesTableAdapter<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span> SqlTransaction
      Transaction<br />
         {<br />
            get { <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span> _adapter.SelectCommand.Transaction;
      }<br />
            set<br />
            {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         if</span> (_adapter
      == <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)<br />
               {<br />
                  InitAdapter();<br />
               }<br /><br />
               _adapter.InsertCommand.Transaction <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;<br />
               _adapter.UpdateCommand.Transaction <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;<br />
               _adapter.DeleteCommand.Transaction <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;<br />
            }<br />
         }<br />
      }</span>
        </p>
        <p>
      This property assigns the given transaction to the Transaction property on all
      its commands. Now I can do CRUD method as I like with knowing that is under SQLTransaction
      control:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">CitiesTableAdapter
      citiesAdapter <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> CitiesTableAdapter();<br /><br />
      citiesAdapter.Connection.Open();<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">try</span><br />
      {<br />
         SqlTransaction trans <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> citiesAdapter.Connection.BeginTransaction();<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   try</span><br />
         {<br />
            citiesAdapter.Transaction <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> trans;<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      // CRUD the
      table, commit transaction or </span><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">rollback
      if there's a problem</span></span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          </span>
        </p>
        <p>
       
   </p>
        <p>
          <font face="Verdana" size="2">Nice way of implementing, hope it helped someone...</font>
        </p>
        <p>
          <font face="Verdana" size="2">See you</font>
          <br />
        </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=6e26a414-6a87-47a6-b9c0-e3be26298852" />
      </body>
      <title>SqlTransaction or TransactionScope with Typed Dataset</title>
      <guid>http://www.eranachum.com/PermaLink,guid,6e26a414-6a87-47a6-b9c0-e3be26298852.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,6e26a414-6a87-47a6-b9c0-e3be26298852.aspx</link>
      <pubDate>Mon, 19 Jun 2006 06:46:54 GMT</pubDate>
      <description>&lt;p&gt;
   Hey all!
&lt;/p&gt;
&lt;p&gt;
   While developing the Data Access Layer (DAL) in my "home developing" project - &lt;a href="http://www.haverut.co.il/" target=_blank&gt;&lt;strong&gt;Haverut.co.il&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;I
   deliberated wheather to use the old fashioned way - the Application Blocks of Microsoft,
   which I need to implement all the database&amp;nbsp;contact by hand and use the 'jacket'
   of the Application Blocks adapters &lt;strong&gt;OR&lt;/strong&gt;&amp;nbsp;to use Typed datasets... 
   &lt;br&gt;
   I decided to use the second choice, because (as knows)&amp;nbsp;this module knows to generate
   code of&amp;nbsp;database tables and to create by default the main CRUD (Create, Read,
   Update and Delete) methods and also custom SQL queries.
&lt;/p&gt;
&lt;p&gt;
   But this is not the main issue of this post... 
&lt;/p&gt;
&lt;p&gt;
   While working, I needed to do several connected commands against the database, therefore
   I needed to use the Transaction term to knot these commands and to avoid database's
   commands failure or 'half-way actions'.
&lt;/p&gt;
&lt;p&gt;
   Now, the biggest deliberation: To use &lt;strong&gt;SQLTransction&lt;/strong&gt; module or &lt;strong&gt;TransactionScope&lt;/strong&gt; module&amp;nbsp;(which
   is new module that cane out in .NET 2.0)?
&lt;/p&gt;
&lt;p&gt;
   In the first thought I decided to use &lt;strong&gt;TransactionScope&lt;/strong&gt;, because it's
   very easy to use and it doesn't make "pain in the neck". The usage it easy: you need
   to wrap the wanted scope with this module and all the job will be done safely under
   this transaction.&lt;br&gt;
   further documentation you can find here:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;a href="http://msdn2.microsoft.com/en-us/library/system.transactions.transactionscope.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.transactions.transactionscope.aspx&lt;/a&gt; 
   &lt;li&gt;
      &lt;a href="http://msdn2.microsoft.com/en-us/library/ms172152.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms172152.aspx&lt;/a&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   But this module holds not much of disadvantages like: 
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      Low performence of this action in the application, in large amount of users and actions
      the performance of this actions will be very bad and slow. 
   &lt;li&gt;
      By default, when using this module, the system tries to look for a transaction that
      is otherwise current, or a &lt;b&gt;TransactionScope&lt;/b&gt; object that dictates that &lt;strong&gt;Current &lt;/strong&gt;(a
      static property of this namespace)&amp;nbsp;is &lt;strong&gt;null. &lt;/strong&gt;If it cannot find
      either one of these, &lt;strong&gt;System.Transactions&lt;/strong&gt; queries the COM+ context
      for a transaction. Note that even though &lt;strong&gt;System.Transactions&lt;/strong&gt; may
      find a transaction from the COM+ context, it still favors transactions that are native
      to &lt;strong&gt;System.Transactions&lt;/strong&gt;. This thing is not recommended because we
      need to handle the COM+ context in addition to our application context. More info
      you can find &lt;strong&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms229974.aspx" target=_blank&gt;here.&lt;/a&gt;&lt;/strong&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   Because of that, I decided to use &lt;strong&gt;SQLTransaction&lt;/strong&gt;s over my Typed Datasets'
   actions.
&lt;/p&gt;
&lt;p&gt;
   To do this in appropriate way, I used&amp;nbsp;a &lt;u&gt;partial class&lt;/u&gt; (very nice innovation
   in .NET 2.0) with the same name of the Typed DS class, to 'continue' its code and
   overload some of the&amp;nbsp;members like the main member that does the connection with
   the database: &lt;strong&gt;_adapter.&lt;br&gt;
   &lt;/strong&gt;This member is private and is not accessible to outside requests. 
&lt;/p&gt;
&lt;p&gt;
   Instead of a BeginTransaction method, I have implemented a Transaction property on
   my TableAdapters, like this:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;partial &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; CitiesTableAdapter&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; SqlTransaction
   Transaction&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get { &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; _adapter.SelectCommand.Transaction;
   }&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/span&gt; (_adapter
   == &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;InitAdapter();&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_adapter.InsertCommand.Transaction &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_adapter.UpdateCommand.Transaction &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_adapter.DeleteCommand.Transaction &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   This&amp;nbsp;property assigns the given transaction to the Transaction property on all
   its commands. Now I can do CRUD method as I like with knowing that is under SQLTransaction
   control:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;CitiesTableAdapter
   citiesAdapter &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; CitiesTableAdapter();&lt;br&gt;
   &lt;br&gt;
   citiesAdapter.Connection.Open();&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;try&lt;/span&gt;
   &lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;SqlTransaction trans &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; citiesAdapter.Connection.BeginTransaction();&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;try&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;citiesAdapter.Transaction &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; trans;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;CRUD&amp;nbsp;the
   table, commit transaction or &lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;rollback
   if there's a problem&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Verdana size=2&gt;Nice way of implementing, hope it helped someone...&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Verdana size=2&gt;See you&lt;/font&gt;
   &lt;br&gt;
&lt;/p&gt;
&gt;&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=6e26a414-6a87-47a6-b9c0-e3be26298852" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=7a72f3b0-c8d6-4ce5-830f-b9eb5d747346</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,7a72f3b0-c8d6-4ce5-830f-b9eb5d747346.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hi!
   </p>
        <p>
      Yeasterday, while working on a big web application project, I wanted to copy System.Collections.Generic.Dictionary&lt;TKey,
      TValue&gt;'s values to a System.Collections.Generic.List&lt;TValue&gt;. 
   </p>
        <p>
      Instead running a loop over the Dictionary&lt;T, K&gt; and copy its values to
      the List&lt;T&gt;, I used the <strong>AddRange(TValues)</strong> method.<br />
      For example:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dictionary&lt;<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span>,
      Job&gt; myDictioanry <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Dictionary&lt;<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span>,
      Job&gt;();<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//Fill
      the Dictionary...</span><br /><br />
      List&lt;Job&gt; listJobs <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> List&lt;Job&gt;();<br />
      listJobs.AddRange(myDictioanry.Values);</span>
        </p>
        <p>
      Hope it will help someone... 
      <br />
      see you later
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=7a72f3b0-c8d6-4ce5-830f-b9eb5d747346" />
      </body>
      <title>Copy Dictionary&lt;TKey, TValue&gt; values to List&lt;TValue&gt;</title>
      <guid>http://www.eranachum.com/PermaLink,guid,7a72f3b0-c8d6-4ce5-830f-b9eb5d747346.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,7a72f3b0-c8d6-4ce5-830f-b9eb5d747346.aspx</link>
      <pubDate>Mon, 12 Jun 2006 06:01:28 GMT</pubDate>
      <description>&lt;p&gt;
   Hi!
&lt;/p&gt;
&lt;p&gt;
   Yeasterday, while working on a big web application project, I wanted to copy System.Collections.Generic.Dictionary&amp;lt;TKey,
   TValue&amp;gt;'s values to a System.Collections.Generic.List&amp;lt;TValue&amp;gt;. 
&lt;/p&gt;
&lt;p&gt;
   Instead running a loop over the Dictionary&amp;lt;T, K&amp;gt;&amp;nbsp;and copy its values to
   the List&amp;lt;T&amp;gt;, I used the &lt;strong&gt;AddRange(TValues)&lt;/strong&gt; method.&lt;br&gt;
   For example:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Dictionary&amp;lt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt;,
   Job&amp;gt; myDictioanry &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt;,
   Job&amp;gt;();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//Fill
   the Dictionary...&lt;/span&gt;
   &lt;br&gt;
   &lt;br&gt;
   List&amp;lt;Job&amp;gt; listJobs &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; List&amp;lt;Job&amp;gt;();&lt;br&gt;
   listJobs.AddRange(myDictioanry.Values);&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Hope it will help someone... 
   &lt;br&gt;
   see you later
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=7a72f3b0-c8d6-4ce5-830f-b9eb5d747346" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=4ee04559-291f-4a35-bb28-64dd408853e8</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,4ee04559-291f-4a35-bb28-64dd408853e8.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I am developing from this month a new web application project, and I think this will
      be one of the best *** sites on the web (*** means that the plan is still secret).
      The site will be called <strong>Haverut </strong>and it will be hosted on: <a href="http://www.haverut.co.il/">www.haverut.co.il</a> or <a href="http://www.haverut.com/">www.haverut.com</a>.
   </p>
        <p>
      Now, as you know (or not), Microsoft has a nice <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Custom
      Membership and Roles Providers that generates very comfortable SQL Server database
      to work with and very comprehensive API to communicate with that enable you to manage
      all the membership and roles issue.</span></p>
        <p>
          <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">In my first thought, I was
      planing to build the pilot of my application to work with MS Access database, and
      ofcourse I wanted to use the <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Custom
      Membership and Roles Providers that Microsot supplies. After long searches on the
      web I found a msi file (you can dowload it <a href="http://msdn.microsoft.com/vstudio/eula.aspx?id=96713a8e-b8d4-4d6e-bb8f-027e6c8e15d8" target="_blank">here</a>) that
      after you install it on your machine, it opens you a new template possibility in VS
      2005 that called 'ASP.NET Access Providers'. </span></span>
          <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
            <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">This
      template generates you automaticly the Access database with all its tables and queries.</span>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
            <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">But,
      on the second thought I decided to build the database on SQL Server from the begining
      (much more secure and efficient).  </span>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
            <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">A
      very good acticle and tutorials references you can find at Scott Guthrie's blog at: <a href="http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx">http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx</a></span>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
            <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">See
      you...</span>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
            <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">(P.S.
      - If I didn't mentioned, the <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Custom
      Membership and Roles Providers is exist in the first place for SQL Server and you
      can activate with the <u>aspnet_reqsql</u>  command from the Visual Studio
      2005 Command Prompt).</span></span>
          </span>
        </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=4ee04559-291f-4a35-bb28-64dd408853e8" />
      </body>
      <title>ASP.NET 2.0 Membership, Roles, Forms Authentication, and Security Resources tools</title>
      <guid>http://www.eranachum.com/PermaLink,guid,4ee04559-291f-4a35-bb28-64dd408853e8.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,4ee04559-291f-4a35-bb28-64dd408853e8.aspx</link>
      <pubDate>Thu, 08 Jun 2006 06:13:15 GMT</pubDate>
      <description>&lt;p&gt;
   I am developing from this month a new web application project, and I think this will
   be one of the best *** sites on the web (*** means that the plan is still secret).
   The site will be called &lt;strong&gt;Haverut &lt;/strong&gt;and it will be hosted on: &lt;a href="http://www.haverut.co.il/"&gt;www.haverut.co.il&lt;/a&gt;&amp;nbsp;or &lt;a href="http://www.haverut.com/"&gt;www.haverut.com&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   Now, as you know (or not), Microsoft has a nice &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Custom
   Membership and Roles Providers that generates very comfortable SQL Server database
   to work with and very comprehensive API to communicate with that enable you to manage
   all the membership and roles issue.&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In&amp;nbsp;my first thought, I was
   planing to build the pilot of my application to work with MS Access database, and
   ofcourse I wanted to use the &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Custom
   Membership and Roles Providers that Microsot supplies. After long searches on the
   web I found&amp;nbsp;a msi file (you can dowload it &lt;a href="http://msdn.microsoft.com/vstudio/eula.aspx?id=96713a8e-b8d4-4d6e-bb8f-027e6c8e15d8" target=_blank&gt;here&lt;/a&gt;)&amp;nbsp;that
   after you install it on your machine, it opens you a new template possibility in VS
   2005 that called 'ASP.NET Access Providers'. &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;This
   template generates you automaticly the Access database with all its tables and queries.&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;But,
   on the second thought I decided to build the database on SQL Server from the begining
   (much more secure and efficient). &amp;nbsp;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;A
   very good acticle and tutorials references you can find at Scott Guthrie's blog at: &lt;a href="http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;See
   you...&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;(P.S.
   - If I didn't mentioned, the &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Custom
   Membership and Roles Providers is exist in the first place for SQL Server and you
   can activate with the &lt;u&gt;aspnet_reqsql&lt;/u&gt;&amp;nbsp;&amp;nbsp;command from the Visual Studio
   2005 Command Prompt).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=4ee04559-291f-4a35-bb28-64dd408853e8" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=a75c451f-2268-4aeb-a0f0-3166c4288e33</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,a75c451f-2268-4aeb-a0f0-3166c4288e33.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Yesterday noon, in a middle of our department's technical conversation, I raised the
      issue of the difference between IHttpHandler and IHttpModule models, because I'm using
      an IHttpHandler logic model in a part of the application I working on. 
   </p>
        <p>
      Also I want to clarify <a href="http://www.lnbogen.com/" target="_blank">OrenEllenbogen</a>'s
      (one of our team leaderes) findings. He claims, correctly, that the clothing
      of an application (Global.asax) is the IHttpModule that "hosts" several IHttpHandlers.
      Now, by the specific request that goes through the IHttpModule firstly, it knows to
      navigate it to the specific handler (IHttpHandler) to handle it.
   </p>
        <p>
      Here, I want to go into details about those two nice and essential models.
   </p>
        <p>
          <strong>
            <u>HttpHandler</u> - </strong>Every typical page (that derives from System.Web.UI.Page)
      implements the IHttpHandler interface. Writing an IHttpHandler is no different that
      writing typical page or control. It includes server application objects like: Session,
      Request and Response. An HttpHandler is created for each request to the server
      and its lifetime exists on the request <strong>ProcessRequest</strong> step. (It important
      to mention that this action happens before the page events are raised (like Page_Init,
      Page_Load etc...)
   </p>
        <p>
      Another thing to know about HttpHandler behavior is the <strong>IsReusable</strong> property
      that defined in the interface. If this retured as true, the HttpHandler won't be destroyed
      when a control exits ProcessRequest - it will be released to the pool for future requestor.
      This means that request specific data must be de-initialized at the end of the request,
      or re-initialized at the begining of a request.
   </p>
        <p>
      Nice example of use is <strong>Url Rewriting</strong>. We used a handler in previous
      a web application development that handles multi-lingual states (supports English
      and Hebrew languages). We wrote an HttpHandler that in every request to the server,
      checks the browser url, and by a specific address symbols "guides" the page what
      language adn direction to display.
   </p>
        <p>
          <strong>
            <u>HttpModule</u> -</strong> The HttpModule is the filter for all requests.
      It receives notification at various processing points during the lifespan of the request.
      We can map HttpModule to all application requets.
   </p>
        <p>
      The main difference between HttpModule to HttpHandler is that HttpModule provides
      class intance for all application's requests and HttpHandler provides single instance
      for each request. Also, HttpModule doesn't store any data about any request because
      it handles all the application requests, opposite to HttpHandler that can store data
      about a specific request (IsReuseable property, remember...?)
   </p>
        <p>
      An important adventage of HttpModule over HttpHandler is by the initializing and
      maintain an application state option, since there is alive class intance all along
      the application lifespan. For example, you can load a data structure (like XML string
      for example) in the Init method and use it safely accross the apllication lifespan. 
   </p>
        <p>
      Hope I answered some questions (if you had some...)
   </p>
        <p>
      A nice implementation example you can find in MSDN or <strong><a href="http://www.devx.com/vb2themax/Article/19901" target="_blank">here</a></strong>.
   </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=a75c451f-2268-4aeb-a0f0-3166c4288e33" />
      </body>
      <title>IHttpHandler VS IHttpModule</title>
      <guid>http://www.eranachum.com/PermaLink,guid,a75c451f-2268-4aeb-a0f0-3166c4288e33.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,a75c451f-2268-4aeb-a0f0-3166c4288e33.aspx</link>
      <pubDate>Tue, 06 Jun 2006 07:29:29 GMT</pubDate>
      <description>&lt;p&gt;
   Yesterday noon, in a middle of our department's technical conversation, I raised the
   issue of the difference between IHttpHandler and IHttpModule models, because I'm using
   an IHttpHandler logic model in a part of the application I working on. 
&lt;/p&gt;
&lt;p&gt;
   Also I want to clarify &lt;a href="http://www.lnbogen.com/" target=_blank&gt;OrenEllenbogen&lt;/a&gt;'s
   (one of our team leaderes)&amp;nbsp;findings. He claims, correctly,&amp;nbsp;that the clothing
   of an application (Global.asax) is the IHttpModule that "hosts" several IHttpHandlers.
   Now, by the specific request that goes through the IHttpModule firstly, it knows to
   navigate it to the specific handler (IHttpHandler) to handle it.
&lt;/p&gt;
&lt;p&gt;
   Here, I want to go into details about those two&amp;nbsp;nice and essential&amp;nbsp;models.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;&lt;u&gt;HttpHandler&lt;/u&gt; - &lt;/strong&gt;Every typical page (that derives from System.Web.UI.Page)
   implements the IHttpHandler interface. Writing an IHttpHandler is no different that
   writing typical page or control. It includes server application objects like: Session,
   Request and&amp;nbsp;Response. An HttpHandler is created for each request to the server
   and its lifetime exists on the request &lt;strong&gt;ProcessRequest&lt;/strong&gt; step. (It important
   to mention that this action happens before the page events are raised (like Page_Init,
   Page_Load etc...)
&lt;/p&gt;
&lt;p&gt;
   Another thing to know about HttpHandler behavior is the &lt;strong&gt;IsReusable&lt;/strong&gt; property
   that defined in the interface. If this retured as true, the HttpHandler won't be destroyed
   when a control exits ProcessRequest - it will be released to the pool for future requestor.
   This means that request specific data must be de-initialized at the end of the request,
   or re-initialized at the begining of a request.
&lt;/p&gt;
&lt;p&gt;
   Nice example of use is &lt;strong&gt;Url Rewriting&lt;/strong&gt;. We used&amp;nbsp;a handler in previous
   a web application development that handles multi-lingual states (supports English
   and Hebrew languages). We wrote an HttpHandler that in every request to the server,
   checks the browser url, and by&amp;nbsp;a specific address symbols "guides" the page what
   language adn direction&amp;nbsp;to display.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;&lt;u&gt;HttpModule&lt;/u&gt; -&lt;/strong&gt;&amp;nbsp;The HttpModule is the filter for all requests.
   It receives notification at various processing points during the lifespan of the request.
   We can map HttpModule to all application requets.
&lt;/p&gt;
&lt;p&gt;
   The main difference between HttpModule to HttpHandler is that HttpModule provides
   class intance for all application's requests and HttpHandler provides single instance
   for each request. Also, HttpModule doesn't store any data about any request because
   it handles all the application requests, opposite to HttpHandler that can store data
   about a specific request (IsReuseable property, remember...?)
&lt;/p&gt;
&lt;p&gt;
   An important adventage of HttpModule over HttpHandler is by the initializing&amp;nbsp;and
   maintain an application state option, since there is alive class intance all along
   the application lifespan. For example, you can load a data structure (like XML string
   for example) in the Init method and use it safely accross the apllication lifespan. 
&lt;/p&gt;
&lt;p&gt;
   Hope I answered some questions (if you had some...)
&lt;/p&gt;
&lt;p&gt;
   A nice implementation example you can find in MSDN or &lt;strong&gt;&lt;a href="http://www.devx.com/vb2themax/Article/19901" target=_blank&gt;here&lt;/a&gt;&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=a75c451f-2268-4aeb-a0f0-3166c4288e33" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=9dd33ac3-8e2d-4816-9f9a-6e8b1361cddd</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,9dd33ac3-8e2d-4816-9f9a-6e8b1361cddd.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello all...
   </p>
        <p>
      After long evening of "Mangaling" and mingling at company party in 'GolfiTech'
      Tel Aviv yesterday, I came up to work this morning and decided to share you with
      Master Page working.
   </p>
        <p>
      In the current project that we are working on, we are using <strong>MasterPage</strong> (new
      feature in asp.net 2.0). This is a great control that does the work like 'header'
      and 'footer' user controls, for an example, (that are customied by the user),
      it comes to let us better and easier unified design to all (ao some of) the application
      pages.
   </p>
        <p>
      Good tutorials and example how to create Master Page you can find: <a href="http://aspnet.4guysfromrolla.com/articles/010505-1.aspx" target="_blank">here</a>.
   </p>
        <p>
      And now to the issue of this post. In some of the application that I am working on,
      in addition to the super master page, there is a nested one. Now, when I tried to
      get the control (from the server side ofcrouse) that sits in the nested master page
      I couldn't find it, and this was a problem ofcourse... :)
   </p>
        <p>
      The solution is to go up until you reach the super master page and after it to
      go down to the nested master page where the control is. The syntax is:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Page.Master.Master.FindControl(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"&lt;Container
      Name&gt;"</span>).FindControl(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"&lt;Control
      Name&gt;"</span>);</span>
        </p>
        <p>
      Where the &lt;Container Name&gt; is the placeholder that holds the page.
   </p>
        <p>
      Hope this will help someday...
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=9dd33ac3-8e2d-4816-9f9a-6e8b1361cddd" />
      </body>
      <title>Working with nested Master Page</title>
      <guid>http://www.eranachum.com/PermaLink,guid,9dd33ac3-8e2d-4816-9f9a-6e8b1361cddd.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,9dd33ac3-8e2d-4816-9f9a-6e8b1361cddd.aspx</link>
      <pubDate>Wed, 31 May 2006 06:32:55 GMT</pubDate>
      <description>&lt;p&gt;
   Hello all...
&lt;/p&gt;
&lt;p&gt;
   After long evening of&amp;nbsp;"Mangaling" and mingling at company party in 'GolfiTech'
   Tel Aviv&amp;nbsp;yesterday, I came up to work this morning and decided to share you with
   Master Page working.
&lt;/p&gt;
&lt;p&gt;
   In&amp;nbsp;the current project that we are working on, we are&amp;nbsp;using &lt;strong&gt;MasterPage&lt;/strong&gt; (new
   feature in asp.net 2.0). This is a great control that does the work like 'header'
   and 'footer' user controls, for an example,&amp;nbsp;(that are customied by the user),
   it comes to let us better and easier unified design to all (ao some of) the application
   pages.
&lt;/p&gt;
&lt;p&gt;
   Good tutorials and example how to create Master Page you can find: &lt;a href="http://aspnet.4guysfromrolla.com/articles/010505-1.aspx" target=_blank&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   And now to the issue of this post. In some of the application that I am working on,
   in addition to the super master page, there is a nested one. Now, when I tried to
   get the control (from the server side ofcrouse) that sits in the nested master page
   I couldn't find it, and this was a problem ofcourse... :)
&lt;/p&gt;
&lt;p&gt;
   The solution is to go&amp;nbsp;up until you reach the super master page and after it to
   go down to the nested master page where the control is. The syntax is:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Page.Master.Master.FindControl(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"&amp;lt;Container
   Name&amp;gt;"&lt;/span&gt;).FindControl(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"&amp;lt;Control
   Name&amp;gt;"&lt;/span&gt;);&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Where the &amp;lt;Container Name&amp;gt; is the placeholder that holds the page.
&lt;/p&gt;
&lt;p&gt;
   Hope this will help someday...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=9dd33ac3-8e2d-4816-9f9a-6e8b1361cddd" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=35ee5c6c-b92d-4131-b108-4696a0730800</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,35ee5c6c-b92d-4131-b108-4696a0730800.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello all again...
   </p>
        <p>
      Some monthes ago, while reading professional tutorials, I encountered with a nice
      implementation (maybe some of you encountered it before, but I think this is a nice
      syntax to know) and it called <strong>Smart Indexer</strong> of a specific object.
   </p>
        <p>
      Look at the example below:
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> EranEntity<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   private</span> Hashtable
      qualities <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> Hashtable();<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Indexer (i.e. smart array) </span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>[<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> key]<br />
         {<br />
            get { <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">return</span> qualities[key];
      }<br />
            set { qualities[key] <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;
      }<br />
         }<br />
      }</span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          </span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">Here,
      I've created new class called, 'EranEntity' and it contains a Hashtable that holds
      all of my qualities (and I have a lot of it, as you know... :)). By building this
      property, it will be much easier to get quality or to update one using 'Dictionary'
      - the interface is much more readable and easier to use.</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">Now,
      lets set some qualities:</font>
          </span>
        </p>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span>
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">static</span>
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Main()<br />
      {<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   //
      Create EranEntity instance</span><br />
         EranEntity entity <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> EranEntity();<br /><br />
         entity[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"smart"</span>] <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"very
      good…"</span>;<br />
         entity[<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"nice"</span>] <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"very
      nice…"</span>;<br />
      }</span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">Today
      in the new world of terms of .NET 2.0, we can also implement this genericly using
      the new <strong>Generics </strong>mechanism.</font>
            </span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">p.s.</font>
            </span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">Another
      thing, there is a VS. 2005 quick shortcut to do it</font>
            </span>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2"> by
      typing the word: <strong>indexer</strong> (in the editor ofcourse...) and clicking
      the Tab key until the whole bunch of code is being generated for you to edit.</font>
            </span>
          </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">
              </font>
            </span> 
   </p>
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font face="Verdana" size="2">See
      you for now...</font>
            </span>
          </p>
        </span>
        <p>
          <font face="Verdana" size="2">
          </font>
          <br />
       
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=35ee5c6c-b92d-4131-b108-4696a0730800" />
      </body>
      <title>Smart Indexer</title>
      <guid>http://www.eranachum.com/PermaLink,guid,35ee5c6c-b92d-4131-b108-4696a0730800.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,35ee5c6c-b92d-4131-b108-4696a0730800.aspx</link>
      <pubDate>Wed, 24 May 2006 05:54:13 GMT</pubDate>
      <description>&lt;p&gt;
   Hello all again...
&lt;/p&gt;
&lt;p&gt;
   Some monthes ago, while reading professional tutorials, I encountered with a nice
   implementation (maybe some of you encountered it before, but I think this is a nice
   syntax to know) and it called &lt;strong&gt;Smart Indexer&lt;/strong&gt; of a specific object.
&lt;/p&gt;
&lt;p&gt;
   Look at the example below:
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; EranEntity&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt; Hashtable
   qualities &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; Hashtable();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Indexer (i.e. smart array)&amp;nbsp;&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;[&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; key]&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get { &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;return&lt;/span&gt; qualities[key];
   }&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set { qualities[key] &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;
   }&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Here,
   I've created new class called, 'EranEntity' and it contains a Hashtable that holds
   all of my qualities (and I have a lot of it, as you know... :)). By building this
   property, it will be much easier to get quality or to update one using 'Dictionary'
   - the interface is much more readable and easier to use.&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Now,
   lets set some qualities:&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;static&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Main()&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
   Create EranEntity&amp;nbsp;instance&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;EranEntity&amp;nbsp;entity &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; EranEntity();&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;entity[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"smart"&lt;/span&gt;] &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"very
   good…"&lt;/span&gt;;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;entity[&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"nice"&lt;/span&gt;] &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"very
   nice…"&lt;/span&gt;;&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Today
   in the new world of terms of .NET 2.0, we can also implement this genericly using
   the new &lt;strong&gt;Generics &lt;/strong&gt;mechanism.&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;p.s.&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;Another
   thing, there is a VS. 2005 quick shortcut&amp;nbsp;to do it&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;&amp;nbsp;by
   typing the word: &lt;strong&gt;indexer&lt;/strong&gt; (in the editor ofcourse...) and clicking
   the Tab key until the whole bunch of code is being generated for you to edit.&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana size=2&gt;See
   you for now...&lt;/font&gt;
&lt;/p&gt;
&lt;/span&gt; 
&lt;p&gt;
   &lt;font face=Verdana size=2&gt;&lt;/font&gt;
   &lt;br&gt;
   &amp;nbsp;
&lt;/p&gt;
&gt;&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=35ee5c6c-b92d-4131-b108-4696a0730800" /&gt;</description>
      <category>.NET 2005</category>
    </item>
    <item>
      <trackback:ping>http://www.eranachum.com/Trackback.aspx?guid=a301fb0e-64c7-4bca-ad9c-0b6c67b39474</trackback:ping>
      <pingback:server>http://www.eranachum.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.eranachum.com/PermaLink,guid,a301fb0e-64c7-4bca-ad9c-0b6c67b39474.aspx</pingback:target>
      <dc:creator>eranachum@hotmail.com (Eran Nachum)</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Hello all!
   </p>
        <p>
      This is my first blog's post, I am thrilled to start writing my thoughts, and I have
      a lot of them (I think....).
   </p>
        <p>
      In my first post, I will go into details of <strong>'Publish website in .NET 2.0'</strong>,
      this issue is different and renewed then .NET 1.1 - there are several new issues that
      someone that is not familiar with .NET 2.0 will be glad to hear, so lets start...
   </p>
        <p>
      As known, publishing web application under visual studio 2005 platform is different
      than publishing the same application under visual studio 2003 platform. 
   </p>
        <p>
      In <strong><u>VS 2003</u></strong>, when we had wanted to deploy a site (web application)
      to production area, we had need go to the <strong>Project</strong> tab and select
      the <strong>Copy Project</strong> option, this action had gathered all the web site
      execution's necessery files and copied it to a new folder.
   </p>
        <p>
      In <strong><u>VS 2005</u></strong>, we got some innovations that gives us several
      alternatives to deploy web site to production area. The main action to deploy a web
      application to deployment is <strong>Publish</strong>, to do this you need to mark
      the web site project, press the right button and choose <strong>Publish Web Site</strong>.
      When you do this action, the application will be precompiled and it will be saved
      in the specified folder that you noted. 
   </p>
        <p>
      Other actions that you can determine while doing the publish action are:
   </p>
        <ol>
          <li>
         Allowing the precompiled web site to be updatable - by marking this checkbox, all
         the ASPX files with their markup intact as well, will be precompiled into a single
         DLL (under the /bin folder), that represents it. 
      </li>
          <li>
         Using fixed naming  and single page assemblies - choosing this action and the
         former one, will create a single DLL file to each ASPX file. 
      </li>
          <li>
         Enabling string naming on precompiled assemblies - by choosing this option, you will
         need to give strong name to the generated assembly(ies), this name (key) will deffer
         it from newer same name assemblies that precompiled with no strong name or without
         any. 
      </li>
          <li>
         Lastly, if you will publish the web site with none of the checkboxes selected, a single
         DLL will be created with no markup of the ASPX files and compiled metadata files for
         each ASPX file.</li>
        </ol>
        <p>
          <br />
      These actions will be pointed to the aspnet_compiler tool. This tool, supplies a creation
      of debugging symbols, but this action will not be able to happen from publish action,
      because if supplies precompilation in release state without symbols. (You can read
      more about aspnet_compiler here: <a href="http://odetocode.com/Articles/417.aspx">http://odetocode.com/Articles/417.aspx</a>).
   </p>
        <p>
      In order to attach symbols to to web application, there is new tool named: <strong>Web
      Site Deployment (WSD).</strong> You can download it from this address: <a href="http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx">http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx</a>.
      This tool adds several compilations configurations in release and degub mode.
   </p>
        <p>
      In a nutshell, the steps of adding symbols by this tool are:
   </p>
        <ol>
          <li>
         Mark the web site application, right click on you mouse and choose the Add Web Deployment
         Project option. 
      </li>
          <li>
         Select the name and the location of the web site to deploy. 
      </li>
          <li>
         Now, a deployed project had been added to you solution! Mark it and by right clicking,
         select the Property pages option. 
      </li>
          <li>
         Mark Generate debug information and finish. 
      </li>
          <li>
         Build the whole application.<br /></li>
        </ol>
        <p>
      After these actions, a new folder with the given name by you will be created, and
      symbols will be 'stuck' to the application. (Real life example is: In the production
      server, you can see the souce code line while a runtime error will happen, good thing
      right...?)
   </p>
        <p>
      Related links are:
   </p>
        <p>
          <a href="http://download.microsoft.com/download/1/5/4/1541980a-d8fc-407b-8c9f-c2df5445b041/Using%20web_deployment_projects_final.doc">http://download.microsoft.com/download/1/5/4/1541980a-d8fc-407b-8c9f-c2df5445b041/Using%20web_deployment_projects_final.doc</a>
        </p>
        <p>
      Good article about this post: <a href="http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx">http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx</a></p>
        <p>
      That's it for now. I will be glad to hear your comment about this (this is my first
      one, don't forget).
   </p>
        <p>
      See you here...
   </p>
        <p>
       
   </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=a301fb0e-64c7-4bca-ad9c-0b6c67b39474" />
      </body>
      <title>Publish website in .NET 2.0 Innovations</title>
      <guid>http://www.eranachum.com/PermaLink,guid,a301fb0e-64c7-4bca-ad9c-0b6c67b39474.aspx</guid>
      <link>http://www.eranachum.com/PermaLink,guid,a301fb0e-64c7-4bca-ad9c-0b6c67b39474.aspx</link>
      <pubDate>Mon, 22 May 2006 06:37:57 GMT</pubDate>
      <description>&lt;p&gt;
   Hello all!
&lt;/p&gt;
&lt;p&gt;
   This is my first blog's post, I am thrilled to start writing my thoughts, and I have
   a lot of them (I think....).
&lt;/p&gt;
&lt;p&gt;
   In my first post, I will go into details of &lt;strong&gt;'Publish website in .NET 2.0'&lt;/strong&gt;,
   this issue is different and renewed then .NET 1.1 - there are several new issues that
   someone that is not familiar with .NET 2.0 will be glad to hear, so lets start...
&lt;/p&gt;
&lt;p&gt;
   As known, publishing web application under visual studio 2005 platform is different
   than publishing the same application under visual studio 2003 platform. 
&lt;/p&gt;
&lt;p&gt;
   In &lt;strong&gt;&lt;u&gt;VS 2003&lt;/u&gt;&lt;/strong&gt;, when we had wanted to deploy a site (web application)
   to production area, we had need go to the &lt;strong&gt;Project&lt;/strong&gt; tab and select
   the &lt;strong&gt;Copy Project&lt;/strong&gt; option, this action had gathered all the web site
   execution's necessery files and copied it to a new folder.
&lt;/p&gt;
&lt;p&gt;
   In &lt;strong&gt;&lt;u&gt;VS 2005&lt;/u&gt;&lt;/strong&gt;, we got some innovations that gives us several
   alternatives to deploy web site to production area. The main action to deploy a web
   application to deployment is &lt;strong&gt;Publish&lt;/strong&gt;, to do this you need to mark
   the web site project, press the right button and choose &lt;strong&gt;Publish Web Site&lt;/strong&gt;.
   When you do this action, the application will be precompiled and it will be saved
   in the specified folder that you noted. 
&lt;/p&gt;
&lt;p&gt;
   Other actions that you can determine while doing the publish action are:
&lt;/p&gt;
&lt;ol&gt;
   &lt;li&gt;
      Allowing the precompiled web site to be updatable - by marking this checkbox, all
      the ASPX files with their markup intact as well, will be precompiled into a single
      DLL (under the /bin folder), that represents it. 
   &lt;li&gt;
      Using fixed naming&amp;nbsp; and single page assemblies - choosing this action and the
      former one, will create a single DLL file to each ASPX file. 
   &lt;li&gt;
      Enabling string naming on precompiled assemblies - by choosing this option, you will
      need to give strong name to the generated assembly(ies), this name (key) will deffer
      it from newer same name assemblies that precompiled with no strong name or without
      any. 
   &lt;li&gt;
      Lastly, if you will publish the web site with none of the checkboxes selected, a single
      DLL will be created with no markup of the ASPX files and compiled metadata files for
      each ASPX file.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
   &lt;br&gt;
   These actions will be pointed to the aspnet_compiler tool. This tool, supplies a creation
   of debugging symbols, but this action will not be able to happen from publish action,
   because if supplies precompilation in release state without symbols. (You can read
   more about aspnet_compiler here: &lt;a href="http://odetocode.com/Articles/417.aspx"&gt;http://odetocode.com/Articles/417.aspx&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
   In order to attach symbols to to web application, there is new tool named: &lt;strong&gt;Web
   Site Deployment (WSD).&lt;/strong&gt; You can download it from this address: &lt;a href="http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx"&gt;http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx&lt;/a&gt;.
   This tool adds several compilations configurations in release and degub mode.
&lt;/p&gt;
&lt;p&gt;
   In a nutshell, the steps of adding symbols by this tool are:
&lt;/p&gt;
&lt;ol&gt;
   &lt;li&gt;
      Mark the web site application, right click on you mouse and choose the Add Web Deployment
      Project option. 
   &lt;li&gt;
      Select the name and the location of the web site to deploy. 
   &lt;li&gt;
      Now, a deployed project had been added to you solution! Mark it and by right clicking,
      select the Property pages option. 
   &lt;li&gt;
      Mark Generate debug information and finish. 
   &lt;li&gt;
      Build the whole application.&lt;br&gt;
   &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
   After these actions, a new folder with the given name by you will be created, and
   symbols will be 'stuck' to the application. (Real life example is: In the production
   server, you can see the souce code line while a runtime error will happen, good thing
   right...?)
&lt;/p&gt;
&lt;p&gt;
   Related links are:
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://download.microsoft.com/download/1/5/4/1541980a-d8fc-407b-8c9f-c2df5445b041/Using%20web_deployment_projects_final.doc"&gt;http://download.microsoft.com/download/1/5/4/1541980a-d8fc-407b-8c9f-c2df5445b041/Using%20web_deployment_projects_final.doc&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   Good article about this post: &lt;a href="http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx"&gt;http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   That's it for now. I will be glad to hear your comment about this (this is my first
   one, don't forget).
&lt;/p&gt;
&lt;p&gt;
   See you here...
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.eranachum.com/aggbug.ashx?id=a301fb0e-64c7-4bca-ad9c-0b6c67b39474" /&gt;</description>
      <category>.NET 2005</category>
    </item>
  </channel>
</rss>