title: Table of Unique Strings with Fluent NHibernate
body: <p>I have a class Item and a class ItemAttribute, where Item has a property of type ItemAttribute.</p>
  
  <p>ItemAttribute only has two properties, a Guid called ID and a string called name. The idea here is that I want to store a table called ItemAttributes that contains a list of unique strings.</p>
  
  <p>My question is, if I save an Item that references an ItemAttribute that already exists in the database, how can I make it reference the already existing ItemAttribute, rather than creating a new one?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Kristoffer Ahl better expresses what I'm trying to do in <a href="https://stackoverflow.com/questions/290305/nhibernate-many-to-one-and-unique-constraint-violation/1305419#1305419">this post</a>.</p>
  
  <p>It looks like what I want to do isn't possible :(</p>
  
  <p>So, let's abstract things a bit :)  The purpose of the ItemAttributes table is simply to reduce duplication, so I can just store each attribute once, and link to the Item using an identifier.</p>
  
  <p>If I could generate a unique ID for each attribute I could assign this ID and code - that should work!</p>
  
  <p>But how can I generate a unique ID for a string? The ID must be consistent, such that the same ID will be generated for the same string each time.</p>