title: Why does this NHibernate Linq query attempt to execute an insert statement?
body: <p>I am encountering a very strange issue I wonder if anyone has seen before. I have as part of my Save() method in a repository that it will search out and find each associated tag by it's name. There is a line in there that looks like this.</p>
  
  <pre><code>var tagRepo = (from t in tagRepository.Query() where t.Name == tag.Name select t).SingleOrDefault();
  </code></pre>
  
  <p>As soon as that line executes it throws this exceptions</p>
  
  <pre><code>GenericADOException: could not insert: [Core.Domain.Model.Tag][SQL: INSERT INTO [Tag] (Name) VALUES (?); select SCOPE_IDENTITY()]]
  </code></pre>
  
  <p>As far as I can tell or understand about what is happening here the Linq query shouldn't be executing an insert statement. Any ideas?</p>
  
  <p>Thanks.</p>