title: map structured data classes in NHibernate
body: <p>I would like to map a structured data class in C# to a table in NHibernate</p>
  
  <pre><code>namespace X
  {
      [DataContract]
      class StructureID
      {
          [DataMember] public string Value { get; set; }
      }
      [DataContract]
      class StructureNR
      {
          [DataMember] public string Value { get; set; }
      }
  }
  namespace Y
  {
      [DataContract]
      class SubStructure
      {
          [DataMember] public string SomeData { get; set; }
          [DataMember] public string MoreData { get; set; }
      }
      [DataContract]
      class Structure
      {
          [DataMember] public StructureID StructureID { get; set; }
          [DataMember] public SubStructure SubData { get; set; }
          [DataMember] public string OtherData { get; set; }
      }
  }
  </code></pre>
  
  <p>The table would contain colums like this:</p>
  
  <pre><code>CREATE TABLE Structures (
      ID varchar(10) NOT NULL,
      SOME varchar(50) DEFAULT NULL,
      MORE varchar(50) DEFAULT NULL,
      OTHER varchar(50) DEFAULT NULL,
      PRIMARY KEY (ID)
  );
  </code></pre>
  
  <p>The StructureID and StructureNR classes are semantic wrappers to let the compiler separate different meanings of "string", and SubStructure groups several members together. How would I map the Structure class to my table for read and write (we used XML definitions up to now)?</p>