title: Overloading generic methods
body: <p>When calling a generic method for storing an object there are occasionally needs to handle a specific type differently.  I know that you can't overload based on constraints, but any other alternative seems to present its own problems.</p>
  
  <pre><code>public bool Save&lt;T&gt;(T entity) where T : class
  { ... some storage logic ... }
  </code></pre>
  
  <p>What I would LIKE to do is something like the following:</p>
  
  <pre><code>public bool Save&lt;SpecificClass&gt;(T entity)
  { ... special logic ... }
  </code></pre>
  
  <p>In the past our team has created 'one-off' methods for saving these classes as follows:</p>
  
  <pre><code>public bool SaveSpecificClass(SpecificClass sc)
  { ... special logic ... }
  </code></pre>
  
  <p>However, if you don't KNOW that function exists, and you try to use the generic (Save) then you may run into a host of problems that the 'one-off' was supposed to fix.  This can be made worse if a new developer comes along, sees the problem with the generic, and decides he's going to fix it with <em>his own</em> one-off function.</p>
  
  <p>So...</p>
  
  <p>What are the options for working around this seemingly common issue?</p>
  
  <p>I've looked at, and used UnitOfWork and right now that seems to be the <em>only</em> option that actually resolves the problem - but seems like attacking a fly with a sledgehammer.</p>