title: Merge with generic Type Nhibernate
body: <p>This is my AbstractNHibernateDao, i'd like to use SaveOrUpdateCopy with Merge command, but when i'm trying to use with Type T I have following error</p>
  
  <blockquote>
    <p>Error 1   The type 'T' must be a reference type in order to use it as
    parameter 'T' in the generic type or method
    'NHibernate.ISession.Merge(T)'</p>
  </blockquote>
  
  <pre><code>public abstract class AbstractNHibernateDao&lt;T, TIdT&gt; : IDao&lt;T, TIdT&gt;
      {
          private readonly Type _persitentType = typeof (T);
  
          /// &lt;summary&gt;
          ///   Exposes the ISession used within the DAO.
          /// &lt;/summary&gt;
          private static ISession NHibernateSession
          {
              get { return NHibernateSessionManager.Instance.GetSession(); }
          }
  
          #region IDao&lt;T,TIdT&gt; Members
  
  
  
          /// &lt;summary&gt;
          ///   For entities that have assigned ID's, you must explicitly call Save to add a new one. See http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-id-assigned.
          /// &lt;/summary&gt;
          public T Save(T entity)
          {
              NHibernateSession.Save(entity);
              NHibernateSession.Flush();
              return entity;
          }
  
          /// &lt;summary&gt;
          ///   For entities with automatatically generated IDs, such as identity, SaveOrUpdate may be called when saving a new entity. SaveOrUpdate can also be called to update any entity, even if its ID is assigned.
          /// &lt;/summary&gt;
          public T SaveOrUpdate(T entity)
          {
              NHibernateSession.SaveOrUpdate(entity);
              NHibernateSession.Flush();
              return entity;
          }
  
          public T SaveOrUpdateCopy(T entity)
          {
              NHibernateSession.Merge(entity);
              return entity;
          } 
  
          public void Delete(T entity)
          {
              NHibernateSession.Delete(entity);
              NHibernateSession.Flush();
          }
  
          /// &lt;summary&gt;
          ///   Commits changes regardless of whether there's an open transaction or not
          /// &lt;/summary&gt;
          public void CommitChanges()
          {
              if (NHibernateSessionManager.Instance.HasOpenTransaction())
              {
                  NHibernateSessionManager.Instance.CommitTransaction();
              }
              else
              {
                  // If there's no transaction, just flush the changes
                  NHibernateSessionManager.Instance.GetSession().Flush();
              }
          }
  
      }
  </code></pre>
  
  <p>How could i use it?</p>