Implementation of idbag

cremor's Avatar

cremor

01 Sep, 2010 10:30 AM via web

Since I need an idbag in my current project, I tried to implement it in Fluent NHibernate (based on 1.1.0.692). The idbag itself seems to work and all existing unit tests still succeed, but the code isn't ready for the trunk yet.

Maybe someone can finish my work and polish it up so it can be included in the official trunk?

Usage example:

HasMany(x => x.Items)
   .AsIdBag(id => {
      id.Column("item_id");
      id.Type(typeof(long));
      id.GeneratedBy.Sequence("items_seq");
   })

TODO:

  • Somehow rewrite the 'CollectionIdBuilder' so that the 'GeneratedBy' property doesn't rely on the 'Type' beeing set first.
  • Prevent the usage of an 'one-to-many' element inside the 'idbag' (not allowed by NHibernate).
  • Extend it for many-to-many.
  • Check if there is any change needed for conventions, automapping or the Specs project (I didn't touch these things at all).
  • Write unit tests.
  • General cleanup (I don't think that I matched the design of the existing code with all my extensions).

Note:
I didn't include support for the 'column' element inside an 'collection-id' element because the NHibernate xsd specifies the attributes 'column' and 'type' as required, so I don't think it would work.

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      What is the last month of the year?