Uploaded image for project: 'NHibernate'
  1. NHibernate
  2. NH-2989

ComponentAsId does not set Id Property

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0.GA
    • Fix Version/s: 3.3.0.CR1
    • Component/s: Mapping by-code
    • Labels:

      Description

      "name" attribute is not set to property name in generated xml-mapping when using ComponentAsId.

      e.g.
      mapper.Class<MyClass>(map => map.ComponentAsId(id => id.Identity, cid =>

      { cid.Property(x => x.Id, x => x.Length(20)); cid.Property(x => x.EffectiveDate); }

      ));

      Actual:
      <composite-id class="EffectiveDateId, Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <key-property name="Id" type="AnsiString" length="20" />
      <key-property name="EffectiveDate" />
      </composite-id>

      Expected:
      <composite-id name="Identity" class="EffectiveDateId, Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <key-property name="Id" type="AnsiString" length="20" />
      <key-property name="EffectiveDate" />
      </composite-id>

      possibly related: NH-2987
      See http://stackoverflow.com/questions/8676120/nhibernate-componentasid-does-not-actually-set-id-property

        Issue Links

          Activity

          Hide
          eamon Eamon Hetherton added a comment -

          Created test case and fix.

          Show
          eamon Eamon Hetherton added a comment - Created test case and fix.
          Hide
          eamon Eamon Hetherton added a comment -
          Show
          eamon Eamon Hetherton added a comment - Created a pull request instead https://github.com/nhibernate/nhibernate-core/pull/42
          Hide
          eamon Eamon Hetherton added a comment -
          Show
          eamon Eamon Hetherton added a comment - Created a pull request instead https://github.com/nhibernate/nhibernate-core/pull/42
          Hide
          oskar.berggren Oskar Berggren added a comment -

          Contributed fix committed. Thanks!
          95bf30476565c71c46aff46577439d1f2c7c42f4

          Show
          oskar.berggren Oskar Berggren added a comment - Contributed fix committed. Thanks! 95bf30476565c71c46aff46577439d1f2c7c42f4
          Hide
          oskar.berggren Oskar Berggren added a comment -

          Closing issues fixed in 3.3.1.CR1.

          Show
          oskar.berggren Oskar Berggren added a comment - Closing issues fixed in 3.3.1.CR1.

            People

            • Assignee:
              Unassigned
              Reporter:
              eamon Eamon Hetherton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Who's Looking?